473,385 Members | 2,274 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Checking for Radio buttons

Hi,

I have an application with 177 radio buttons on a screen (Don't ask!). Is
there a simple want to excute a sub when any of them are checked.

Thanks,

Michael
Mar 15 '06 #1
3 1104
Michael Hesse wrote:
I have an application with 177 radio buttons on a screen (Don't
ask!). Is there a simple want to excute a sub when any of them are
checked.


You could make your own radio button class that inherits from the standard
radio button and add a static event to the definition. Then, override the
onclick method, call the base method, and raise the event. you can then
handle this event like any other from your code.
Mar 15 '06 #2
Great suggestion. Thanks!

Michael
"Leon Mayne" <no****@nospam.com> wrote in message
news:ul**************@tk2msftngp13.phx.gbl...
Michael Hesse wrote:
I have an application with 177 radio buttons on a screen (Don't
ask!). Is there a simple want to excute a sub when any of them are
checked.


You could make your own radio button class that inherits from the standard
radio button and add a static event to the definition. Then, override the
onclick method, call the base method, and raise the event. you can then
handle this event like any other from your code.

Mar 15 '06 #3
Hello, Michael,

Perhaps you could iterate through the controls on your form, and for
those that are radio buttons, use AddHandler to assign the same routine
as the CheckedChanged handler for all of them. Something like:

Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
For Each ctl As Control In Me.Controls
If (TypeOf ctl Is RadioButton) Then
Dim rbt As RadioButton = DirectCast(ctl, RadioButton)
AddHandler rbt.CheckedChanged, _
AddressOf Common_CheckedChanged
End If
Next
End Sub

Private Sub Common_CheckedChanged(ByVal sender As Object, _
ByVal e As System.EventArgs)
Dim rbtSender As RadioButton = DirectCast(sender, RadioButton)
MsgBox(rbtSender.Name & " is now " & rbtSender.Checked)
End Sub

Cheers,
Randy
Michael Hesse wrote:
Hi,

I have an application with 177 radio buttons on a screen (Don't ask!). Is
there a simple want to excute a sub when any of them are checked.

Thanks,

Michael

Mar 16 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: kim | last post by:
I'm trying to check my radio buttons before the form is submitted. The radio button names are the same(pend) because only one should be selected. I also would like to know how to make sure if a...
4
by: Oscar Monteiro | last post by:
I Have to sets of Radio buttons like so: <input type="radio" name=p1 value=1> <input type="radio" name=p1 value=2> <input type="radio" name=p1 value=3> <br> <input type="radio" name=p2 value=1>...
6
by: Craig Keightley | last post by:
I have a page that has n number of radio groups (yes/No) how can i prevent the form being submitted if more than one radio group is not selected? By default all radio groups are unchecked ...
2
by: James P. | last post by:
Help, I need to display radio buttons on a form. The data is from SQL table: each row in each table is displayed as a radio button. I have multiple SQL tables so I understand I need to put...
8
by: helpful sql | last post by:
Hi, I have 2 radio buttons on my Windows form control. The radio button's CheckedChanged event disables or enables other controls on the form based on the value of the Checked property. When the...
1
by: kenny8787 | last post by:
Hi, can anyone help here? I have the following code generated from a database, I want to have javascript calculate the costs of the selected items using radio buttons, subtotal the costs and...
2
by: dpazza | last post by:
Hi, I'm creating a quiz on using a form in VB 2005 express. I have four sets of questions and answers (labels and radio buttons) and I change between which set of questions is currently shown on...
4
by: Blasting Cap | last post by:
I have a page that has a number of radio buttons that will be displayed to different access levels of a user who logs in to my website. For instance, if there are a dozen buttons, user1 will see...
4
by: poex | last post by:
hi. i once found an option that lets u choose more than 1 radio button. for instance: there are 2 radio buttons for a question "Are you a male?" (yes) (no) there are 2 radio buttons for another...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.