Seeing which radio button is checked? 
Author Message
 Seeing which radio button is checked?

Hi,

I have written a script that lists all the controls on a form and stores
their setting in a hash table. You can see what I am trying to do from the
code below. Because 'item' is declared as a Control it does not have the
'Checked' property available to it.

How can I detect which radio button is checked?

Dim item As Control
For Each item In Me.Controls
    If TypeOf item Is RadioButton Then
        if item.Checked = True Then MsgBox("Radio button is checked!")
    End If
Next

Thanks in advance,

Stu



Sat, 06 Aug 2005 18:13:48 GMT  
 Seeing which radio button is checked?
Try this:

Dim item As Control
For Each item In Me.Controls
    If TypeOf item Is RadioButton Then
        if DirectCast(item, RadioButton).Checked = True Then MsgBox("Radio
button is checked!")
    End If
Next

--
==============================================
Happy To Help,
Tom Spink

http://dotnetx.betasafe.com >> VB, VB.NET, C#, C++ Code

One day

Quote:
> Hi,

> I have written a script that lists all the controls on a form and stores
> their setting in a hash table. You can see what I am trying to do from the
> code below. Because 'item' is declared as a Control it does not have the
> 'Checked' property available to it.

> How can I detect which radio button is checked?

> Dim item As Control
> For Each item In Me.Controls
>     If TypeOf item Is RadioButton Then
>         if item.Checked = True Then MsgBox("Radio button is checked!")
>     End If
> Next

> Thanks in advance,

> Stu



Sat, 06 Aug 2005 18:22:41 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Checking for a Checked Radio Button

2. Problem binding the Checked property of a Radio Button

3. API to make radio button and check boxs read only with out turn gray

4. Making Radio Buttons, check boxes , and Frames Transparent

5. API to make radio button and check boxs read only with out turning gray

6. Checking a radio button

7. Triggering checked property in radio buttons

8. IE 3.0 - radio button .checked alternative?

9. radio button checked in IE3.02

10. Radio button or check mark

11. Radio Button vs. Check Mark

12. Disable button and change button value at radio

 

 
Powered by phpBB® Forum Software