Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27517

How do I check the selecteditem of multiple comboboxes at the same time?

$
0
0
I have a chart of 100 combo boxes 10X10. The user is to make a choice for every box and then press a button to test the choices.

I have done the testing by typing out each combobox individually, but there must be a better way than this:

If ComboBox1.SelectedItem = "Y" Then
Label23.Text = correct + 1
Else
Label22.Text = incorrect + 1
End If
If ComboBox2.SelectedItem = "Y" Then
Label23.Text = correct + 1
Else
Label22.Text = incorrect + 1
End If
If ComboBox3.SelectedItem = "Y" Then
Label23.Text = correct + 1
Else
Label22.Text = incorrect + 1
End If

I am sure a loop is the solution, I just don't know how to loop through the controls.

Thanks for any help.

Viewing all articles
Browse latest Browse all 27517

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>