开发者

How to change the dropdown value based on string value in .net winforms

开发者 https://www.devze.com 2023-01-04 06:25 出处:网络
i am using .net winform. based on my string it will focus the drop down value. ex. my dropdown have select value ..if i pass select as a value it should focus 开发者_如何学运维the select option in d

i am using .net winform. based on my string it will focus the drop down value.

ex.

my dropdown have select value ..if i pass select as a value it should focus 开发者_如何学运维the select option in dropdown .


Just set the SelectedItem property.

 comboBox1.Items.Add("Apple");
 comboBox1.Items.Add("Orange");
 comboBox1.Items.Add("Banana");

 comboBox1.SelectedItem = "Orange";
0

精彩评论

暂无评论...
验证码 换一张
取 消