如何在组合框中获取所选项目的值和文本? [英] How can I get the Value and Text of the selected items in combobox?

查看:210
本文介绍了如何在组合框中获取所选项目的值和文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在组合框中添加了项目



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();


这篇关于如何在组合框中获取所选项目的值和文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆