|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to loop thru each controls ?Hi all,
I have a 42 groupboxes in a panel, each groupbox has 3 check boxes in it. The 42 groupboxes are actually in a panel, and the panel is on the second tab page of a tab control... What I need to do is to find out the value of each checkbox (i.e. checked or not), can anyone tell me how to do it? I think it would be easier if I can create an array of groupbox like in vb6, but it seems it's not avaliable in .net .... Thanks~ Kay "Kay" <k*@micxsoft.com> schrieb: You will have to recursively enumerate the controls. Check out the > I have a 42 groupboxes in a panel, each groupbox has 3 check boxes in it. > > The 42 groupboxes are actually in a panel, and the panel is on the second > tab page of a tab control... > > What I need to do is to find out the value of each checkbox (i.e. checked > or not), can anyone tell me how to do it? implementation of 'FindControl' here: Accessing controls by their names or indices <URL:http://dotnet.mvps.org/dotnet/faqs/?id=controlbynameindex&lang=en> -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> You don't say how you identify each checkbox, but try this (not tested, but
I think it works): Dim al As New List(Of CheckBox) Foreach gb as GroupBox in panel.Controls Foreach rb as CheckBox in gb.Controls If rb.Checked Then al.Add(rb) End If Next Next Chuck Gantz Show quoteHide quote "Kay" <k*@micxsoft.com> wrote in message news:e7fxoMcEGHA.1424@TK2MSFTNGP12.phx.gbl... > Hi all, > > I have a 42 groupboxes in a panel, each groupbox has 3 check boxes in it. > > The 42 groupboxes are actually in a panel, and the panel is on the second > tab page of a tab control... > > What I need to do is to find out the value of each checkbox (i.e. checked > or not), can anyone tell me how to do it? > > I think it would be easier if I can create an array of groupbox like in > vb6, but it seems it's not avaliable in .net .... > > Thanks~ > > Kay > |
|||||||||||||||||||||||