Now that I understand what he wants, best to learn in a example:
1. Add as many listboxes as you want to a blank form
2. Add a Button
3. Double Click Button
Add this code
[php]
' Declaring ListCount as a Integer = 0 (starting point)
Dim listcount As Integer = 0
' Check every control on the form
For Each contrl As Control In Me.Controls
' If the ctrl is a listbox
If contrl.[GetType]().ToString().ToUpper() = "SYSTEM.WINDOWS.FORMS.LISTBOX" Then
Dim lb As ListBox = DirectCast(contrl, ListBox)
'Count the listboxes
System.Math.Max(System.Threading.Interlocked.Incre ment(listcount), listcount - 1)
End If
Next
'Display the number of listboxes in a message box
MessageBox.Show(listcount.ToString())
[/php]
You can use the same concept with any control, and instead of using a message box, use anything you would like.