Home All Groups Group Topic Archive Search About

validate radio button in groupbox

Author
21 Oct 2006 4:30 PM
K Forester
Hi,
I am a complete beginner and need help with a form.  There are 2 group
boxes, each containing 3 radio buttons on my form.
I'd like to write a subroutine in a module that checks to be sure that the
user has selected 1 radio button from each groupbox.
How can I do this using Visual Studio 2005 (vb code only)?
Thanks

Author
21 Oct 2006 8:04 PM
Tiago Salgado
You can try something like:

if check1.checked
    is checked
elseif check2.checked
    is checked
elseif check3.checked
    is checked
else
    no one is checked
end if


On Sat, 21 Oct 2006 17:30:59 +0100, K Forester <kfores***@sympatico.ca> 
wrote:

> Hi,
> I am a complete beginner and need help with a form.  There are 2 group
> boxes, each containing 3 radio buttons on my form.
> I'd like to write a subroutine in a module that checks to be sure that 
> the
> user has selected 1 radio button from each groupbox.
> How can I do this using Visual Studio 2005 (vb code only)?
> Thanks
>
>



Author
22 Oct 2006 12:41 AM
rowe_newsgroups
You could also build a global method that would handle all the radios
in the groupbox. This method could then set a set a property indicating
that the user checked one of the radios. Also, you could loop through
the groupbox's controls and use Addhandler to map the events to this
handler - this would automatically add new radios to the handler (if
you plan on adding more than 3 radios to the groupboxes). However, if
you plan on just using the 3 radios, it might be easier to use the
if...then tests.

Thanks,

Seth Rowe


Tiago Salgado wrote:
Show quoteHide quote
> You can try something like:
>
> if check1.checked
>     is checked
> elseif check2.checked
>     is checked
> elseif check3.checked
>     is checked
> else
>     no one is checked
> end if
>
>
> On Sat, 21 Oct 2006 17:30:59 +0100, K Forester <kfores***@sympatico.ca>
> wrote:
>
> > Hi,
> > I am a complete beginner and need help with a form.  There are 2 group
> > boxes, each containing 3 radio buttons on my form.
> > I'd like to write a subroutine in a module that checks to be sure that
> > the
> > user has selected 1 radio button from each groupbox.
> > How can I do this using Visual Studio 2005 (vb code only)?
> > Thanks
> >
> >
>
>
>
> --
> Tiago Salgado //  http://weblogs.pontonetpt.com/tiagosalgado