Created 3 Panels and got it to work with theese loops:
Dim c As CheckBox
Dim intGamesArray(2) As Integer
For Each c In Panel0.Controls()
If c.Checked = True Then
intGamesArray(0) += 1
End If
Next
For Each c In Panel1.Controls()
If c.Checked = True Then
intGamesArray(1) += 1
End If
Next
For Each c In Panel2.Controls()
If c.Checked = True Then
intGamesArray(2) += 1
End If
Next
But it would be nice to do something like this:
(Create one panel and add all 3 panels to that one):
The thing that messes it up is Panel(intNumber).Controls
Is it not possible to define a Class with an variable?
Dim intNumber As Integer
Dim c As CheckBox
For Each Panel In Panel4.Controls()
intNumber = 0
For Each c In Panel(intNumber).Controls
If c.Checked = True Then
intGamesArray(intNumber) += 1
End If
intNumber += 1
Next
intNumber += 1
Next
Edited by stevefox, 02 January 2012 - 07:41 PM.