yogi_bear_79
Member
- Joined
- Sep 30, 2009
- Messages
- 19
- Programming Experience
- Beginner
I am familer with looping thru controls like so:
I have some labels on another form, that due to the design can't be in seperate panels. They are (lblChipColor1 - 6) and (lblChipValue1 - 7). I am trying to populate the color ones from the Array above.
I can obviously loop thru the array, but I can't find a decent way to loop thru just the lblChipColorx lables ignoring the lblChipValue1x labels. It would be easy if they were on seperate panels. I tried adding the labels names to an array of type string and of type label, but got nowhere with that.
Is there another way to group them, or build const array of label names, that I can work with?
VB.NET:
Public ChipColor(5) As String
Dim y As Integer
For Each Control As Control In Panel2.Controls
If TypeOf Control Is ListBox Then
Dim myList As ListBox = DirectCast(Control, ListBox)
ChipColor(y) = myList.Text
y = y + 1
End If
Next
I have some labels on another form, that due to the design can't be in seperate panels. They are (lblChipColor1 - 6) and (lblChipValue1 - 7). I am trying to populate the color ones from the Array above.
I can obviously loop thru the array, but I can't find a decent way to loop thru just the lblChipColorx lables ignoring the lblChipValue1x labels. It would be easy if they were on seperate panels. I tried adding the labels names to an array of type string and of type label, but got nowhere with that.
Is there another way to group them, or build const array of label names, that I can work with?
Last edited: