Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to loop through a combox values list and select one of them

How do I cycle through a ComboBox Values list so I can check each value and select one of them efficiently?

Examples in C# or VB.Net welcome.

like image 248
stighy Avatar asked Mar 24 '12 15:03

stighy


1 Answers

To cycle through combobox values, you can use the Items property. If combobox values are strings, the VB code would look like this:

For each item As String in myComboBox.Items
  'Do something
Next

To select a value, you can use the SelectedItem property:

myComboBox.SelectedItem = "SomeValueInComboBox"
like image 96
Meta-Knight Avatar answered Oct 12 '22 22:10

Meta-Knight