PC Review


Reply
Thread Tools Rate Thread

checking if any radio buttons are checked

 
 
Remi Lillelien
Guest
Posts: n/a
 
      6th Apr 2004
Hello all,

Given I have a GroupBox named grpChoices, within this box i have 8
radiobuttons, named rbtButton1 through rbtButton8.
Now I would like to have a button btnOK which is enabled=false as long as
none of the radiobuttons in grpChoices are checked, and enabled=true when
the user checks one of the radiobuttons.

does anyone have an idea on how to do this, I have seached the documentation
but still no luck (then again I'm not a lucky guy)


thanks

Remi


 
Reply With Quote
 
 
 
 
EricJ
Guest
Posts: n/a
 
      6th Apr 2004
You could do it like this (you have to add the 8 radbuttons)

Private Sub RadioButton_CheckedChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles rbtButton1 .CheckedChanged,
rbtButton8.CheckedChanged
Dim rad As RadioButton
btnOK.Enabled = False
For Each rad In grpChoices.Controls
If rad.Checked Then
btnOK.Enabled = True
End If
Next
End Sub

or if the button stays true after you selected something

Private Sub RadioButton_CheckedChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles rbtButton1 .CheckedChanged,
rbtButton8.CheckedChanged
btnOK.Enabled = True

End Sub

"Remi Lillelien" <remi_strikethis_@eunet.no> wrote in message
news:c4u51j$ra3$(E-Mail Removed)...
> Hello all,
>
> Given I have a GroupBox named grpChoices, within this box i have 8
> radiobuttons, named rbtButton1 through rbtButton8.
> Now I would like to have a button btnOK which is enabled=false as long as
> none of the radiobuttons in grpChoices are checked, and enabled=true when
> the user checks one of the radiobuttons.
>
> does anyone have an idea on how to do this, I have seached the

documentation
> but still no luck (then again I'm not a lucky guy)
>
>
> thanks
>
> Remi
>
>



 
Reply With Quote
 
aqualung
Guest
Posts: n/a
 
      6th Apr 2004
Remi -

One option would be to put this code in all the radio buttons check
changed event (remembering to change the index of the radio button):



If RadioButton1.Checked = True Then
Button1.Enabled = True
Else
Button1.Enabled = False
End If





----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Checking if any item in a radio list is checked Darrel Microsoft ASP .NET 2 27th Apr 2009 04:23 PM
Radio Buttons loosing checked state dpazza@yahoo.com Microsoft VB .NET 2 10th May 2007 02:39 PM
Checking individual Radio Buttons with the same GroupName doesn't work Shadow Lynx Microsoft ASP .NET 0 31st Jul 2006 06:25 AM
Checking for Radio buttons Michael Hesse Microsoft Dot NET 3 16th Mar 2006 10:31 AM
checking radio buttons using VBA tjb Microsoft Excel Worksheet Functions 0 18th Sep 2004 12:00 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:49 AM.