如何在组合框中获取所选项目的值和文本?
问题描述:
我已经在组合框中添加了项目
I already add items in combobox
comboBox1.Items.Add(new ListItem("PLASTMANN","PMN"));
comboBox1.Items.Add(new ListItem("CYBERMATE", "CBM"));
comboBox1.Items.Add(new ListItem("CYBERLEAP", "CLP"));
comboBox1.Items.Add(new ListItem("CYBERMANN", "CMN"));
但我想分别获得文字和价值。
谢谢你的帮助。
but I want to get the Text and Value separately.
thank you for you help.
答
你可以使用
You can use
comboBox1.SelectedValue.ToString();
和
and
comboBox1.SelectedText.ToString();