如何从comboBox中选择值 [英] How to get the value selected from a comboBox

查看:121
本文介绍了如何从comboBox中选择值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从comboBox中获取所选值,但我只获取组合框的数据源。自动创建comboBox。我使用以下代码: -



  for  int  i =  0 ; i <  count; i ++)
{
string s4 = i.ToString()+ < span class =code-string> unit;
cunit =(ComboBox)flowLayoutPanel1.Controls.Find(s4, true )[ 0 ];
}





解决方案

combobox.value返回你的价值



之前你必须设置combo.index = i

i am trying to get the selected value from a comboBox but i only gets the datasource of the combobox.The comboBox's are automatically created. i used the following code:-
"

for (int i = 0; i < count; i++)
 {
string  s4 = i.ToString() + "unit";
 cunit = (ComboBox)flowLayoutPanel1.Controls.Find(s4, true)[0];
}  



"

解决方案

combobox.value return your value

and before it in for you must set combo.index=i


这篇关于如何从comboBox中选择值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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