Mar 27, 2003 #1 C Cassio Junior Contributor Joined Nov 30, 2002 Messages 276 Location Rio de Janeiro Which is the best way to verify which checkboxes are checked in a form or a GropBox? Thanks!
Mar 29, 2003 #2 C Cassio Junior Contributor Joined Nov 30, 2002 Messages 276 Location Rio de Janeiro Is it THAT hard? In VB6 I used arrays to check which checkboxes were checked but .NET doenst let me create an array of checkboxes.
Is it THAT hard? In VB6 I used arrays to check which checkboxes were checked but .NET doenst let me create an array of checkboxes.
Mar 29, 2003 #3 V Volte Neutiquam Erro Joined Nov 17, 2002 Messages 2,172 You can use a For Each loop to go through all the checkboxes. Visual Basic: Dim tmp As Checkbox For each tmp in GroupBox1.Controls If tmp.Checked Then 'code End If Next
You can use a For Each loop to go through all the checkboxes. Visual Basic: Dim tmp As Checkbox For each tmp in GroupBox1.Controls If tmp.Checked Then 'code End If Next
Mar 29, 2003 #4 C Cassio Junior Contributor Joined Nov 30, 2002 Messages 276 Location Rio de Janeiro Thanks. Is there a way to do this whitout using a GroupBox? If I do it in a form, with other controls in it, I get a cast exception.
Thanks. Is there a way to do this whitout using a GroupBox? If I do it in a form, with other controls in it, I get a cast exception.
Mar 29, 2003 #5 V Volte Neutiquam Erro Joined Nov 17, 2002 Messages 2,172 Ok, then try something like this: Visual Basic: Dim tmp As Controls For Each tmp in Me.Controls If TypeOf tmp is CheckBox Then If DirectCast(tmp, CheckBox).Checked Then 'code End If End If Next
Ok, then try something like this: Visual Basic: Dim tmp As Controls For Each tmp in Me.Controls If TypeOf tmp is CheckBox Then If DirectCast(tmp, CheckBox).Checked Then 'code End If End If Next
Mar 29, 2003 #6 C Cassio Junior Contributor Joined Nov 30, 2002 Messages 276 Location Rio de Janeiro Thats nice. Thanks a lot!