mardi 18 août 2015

Iterating checkboxes in order in groupbox

I am currently studying VB.NET

I have question about reading checkbox(or textbox or combobox) or read in group box

for example I have this windows form

enter image description here

And I have code like

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    For Each cb As CheckBox In GroupBox1.Controls
        MsgBox(cb.Name)
    Next
End Sub

I was expecting reading checkbox 1 -> 2 -> 3-> 4 -> 5

However, it sometimes read 5->4->3->2->1 or 3->4->2->1->5

I was thinking "Tabindex" might affect read order, so I changed TabIndex for each checkbox. However, it didn't affect to change order of reading checkbox

is there any way to control order of reading checkbox(or anything) in groupbox ?

thanks




Aucun commentaire:

Enregistrer un commentaire