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.
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.



