Results 1 to 6 of 6

Thread: groupbox

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Posts
    138

    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

  2. #2
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Re: groupbox

    You can check it by default at the startup of your form.


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

  3. #3
    Lively Member briedis's Avatar
    Join Date
    Nov 2008
    Location
    Latvia
    Posts
    79

    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.

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109

    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

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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?

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Posts
    138

    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
  •  



Click Here to Expand Forum to Full Width