Cassio Posted March 28, 2003 Posted March 28, 2003 Which is the best way to verify which checkboxes are checked in a form or a GropBox? Thanks! Quote Stream of Consciousness (My blog)
Cassio Posted March 29, 2003 Author Posted March 29, 2003 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. Quote Stream of Consciousness (My blog)
*Experts* Volte Posted March 30, 2003 *Experts* Posted March 30, 2003 You can use a For Each loop to go through all the checkboxes. Dim tmp As Checkbox For each tmp in GroupBox1.Controls If tmp.Checked Then 'code End If Next Quote
Cassio Posted March 30, 2003 Author Posted March 30, 2003 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. Quote Stream of Consciousness (My blog)
*Experts* Volte Posted March 30, 2003 *Experts* Posted March 30, 2003 Ok, then try something like this: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 Quote
Cassio Posted March 30, 2003 Author Posted March 30, 2003 Thats nice. Thanks a lot! Quote Stream of Consciousness (My blog)
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.