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.contr ols
if TypeOf ctr is CheckBox Then
'only the checkbox and the radiobutton have a checkbox
Directcast(ctr, Checkbox.CheckS tate = CheckStateCheck ed
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 SetAllCheckStat eTrue(ByVal parentCtr As Control)
For Each ctr As Control In parentCtr.Contr ols
If TypeOf ctr Is CheckBox Then
DirectCast(ctr, CheckBox).Check State = CheckState.Chec ked
End If
SetAllCheckStat eTrue(ctr)
Next
End Sub
///
I hope this helps,
Cor
"Robert Boudra" <rb*****@comcas t.net> schreef in bericht
news:eS******** ******@TK2MSFTN GP11.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