从组合框中选择项目 [英] Select Item from combobox
本文介绍了从组合框中选择项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
我有一个包含值的字符串,我想从组合框中搜索该值并将其分配为选定项.
我正在使用以下代码,但无法正常工作.还有其他方法吗?
cmbCameraName包含以下项:Add,Delete,Modify
Hello
I have one string which holds value and i want to search that value from combobox and assign as selected item.
i am using following code but not working.is there any other way?
cmbCameraName contains items: Add,Delete,Modify
string CameraName="Add";
int index =Convert.ToInt16(cmbCameraName.FindName(CameraName));
cmbCameraName.SelectedIndex = index;
谢谢
Thanks
推荐答案
您确定您的组合框具有值吗?
如果有值,请尝试以下操作:
are you sure that your combobox has a value?
if it has a value then try this:
int index =Convert.ToInt16(cmbCameraName.FindName(CameraName));
cmbCameraName.SelectedIndex = index;
...
如果您仍然遇到问题,请问我,,
希望对您有所帮助. :)
...
if ur still encountering a probelm ask me,,,
thanks hope it helps. :)
这篇关于从组合框中选择项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文