Robert,
That depends what you want.
In VB6 there was added an extra array that did hold all controls in a form.
Even if it was a child of an other control.
In VBNet every control (from which the form is one) has a control collection
(array).
Which means that all controls on a form can have again controls in
acollection. Think for that just on a groupbox.
You can get all controls direct on a form just by
\\\
for each ctr as control in me.controls
ctr.text = "whatever"
'this goes because every control has a property text
next
///
The same for in a groupbox
\\\
for each ctr as control in groupbox1.controls
if TypeOf ctr is CheckBox Then
'only the checkbox and the radiobutton have a checkbox
Directcast(ctr, Checkbox.CheckState = CheckStateChecked
end if
next
///
If you want to do this for a complete form than you have to do a recursion
trick from which are more, this is the one I like (the shortest to write in
my opinion)
\\\
Private Sub SetAllCheckStateTrue(ByVal parentCtr As Control)
For Each ctr As Control In parentCtr.Controls
If TypeOf ctr Is CheckBox Then
DirectCast(ctr, CheckBox).CheckState = CheckState.Checked
End If
SetAllCheckStateTrue(ctr)
Next
End Sub
///
I hope this helps,
Cor
"Robert Boudra" <rb*****@comcast.net> schreef in bericht
news:eS**************@TK2MSFTNGP11.phx.gbl...
I remember when VB.net came out that a couple of the seminars I went to
mentioned that Control Arrays were going away and that there was a new and
better way to execute the same code when an event occurs in one of a group
of similar controls. Unfortunately, that was several years ago, and I
don't remember how to do this. Can someone refresh my memory?
Bob