|
-
May 6th, 2011, 09:40 AM
#1
Thread Starter
Addicted Member
groupbox
hi gurus
I have a groupbox with two radio buttons on it, is there a way to check if any of the radio button is checked without having to go to individual radio control but from the Groupbox control.
Thanks a bunch
-
May 6th, 2011, 10:57 AM
#2
Re: groupbox
You can check it by default at the startup of your form.
-
May 6th, 2011, 12:23 PM
#3
Lively Member
Re: groupbox
From the actual groupbox control? I doubt. You can loop thru all controls within the groupbox checking for radio buttons which are checked.
-
May 6th, 2011, 12:27 PM
#4
Re: groupbox
The GroupBox should have Controls collection. If all you have in the groupbox is the two radio buttons, then there should be only two controls in the Controls collection, so you could loop through the Controls collection, casting each to a radio button (you will have to do that, since they will be controls, which don't have a Checked property), and checking their checked state. This could be done with LINQ, too, which would be pretty compact.
However, if there is anything else in the GroupBox in addition to the radiobuttons, then you will have to add in a further step to check that the type is radiobutton before casting them.
My usual boring signature: Nothing
 
-
May 6th, 2011, 01:35 PM
#5
Re: groupbox
All of the previous posts compel me to ask the obvious question which is if you are only talking about two buttons, what is the issue with checking them individually?
-
May 6th, 2011, 01:43 PM
#6
Thread Starter
Addicted Member
Re: groupbox
Thanks to all a bunch
hack this time are only two radio controls but what about if I have 20 what then, so I thought maybe at the parent level I could do something.
Thanks all again
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
|