|
-
October 16th, 2002, 08:03 AM
#1
For each Ctl in xxxx, why doesn't this wok
I am trying to loop thru all the controls that are in a groupbox. Here is what I am trying. This is my test code for debuggin.
Dim ctl as Control
Dim x as integer
x=form1.instance.GroupBox2.Controls.Count()
For Each ctl in Form1.instance.GroupBox2.Controls
myname=ctl.name
next
x reports back 76
So I would expect the for loop to loop 76 times. It only loops once.
Why is this? I don't know if this helps. But the GroupBox2 is actually on a TabPage also.
Thanks
-
October 18th, 2002, 11:34 AM
#2
I just can't seem to replicate your problem,
Dim con As Control
Dim a As Integer
For Each con In Me.GroupBox2.Controls
a += 1
Next
MsgBox(a)
I have a groupbox2 on a tabpage with one checkbox, one radiobutton and one button, the MsgBox reports back 3.
Have I got something wrong (am I missing something with the instance thing, why do you need that?)
/Leyan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|