In my VB.NET form I have 50 groupboxes, each containing a combobox named volt
. I used this code to add value to all the comboboxes:
For count = 1 To 50
Dim volt = DirectCast(Me.Controls("volt" & count & ""), ComboBox)
volt.Items.Add("what a code")
Next
but they were placed in different groupbox. When I rewrite it like this:
For count = 1 To 50
Dim volt = DirectCast(groupbox1.Controls("volt" & count & ""), ComboBox)
volt.Items.Add("what a code")
Next
it works in in only groupbox1. How can I make affect the remaining groupboxes?