Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Panels & Radio Buttons

Status
Not open for further replies.

a75537

Programmer
Feb 26, 2003
25
CA
Hi all,

I have a Windows Form with 80 panels. Each panel contains 3 radio buttons (one radio button for Yes, one radio button for No, and one radio button for N/A).

I would like to be able to retrieve the value of the radio button using the Panel. Lets say the Yes radio button has a value of 1 when selected, the No radio button has a value of 2 when selected, and the N/A radio button has a value of 3 when selected.

I would then like to be able to use something like:
If Panel1.??? = 1 (I would then know Yes is selected in Panel1)
If Panel2.??? = 3 (I would then know N/A is selected in Panel2)... and so on.

I have not found a way to do this yet. Am I using the right approach? Any additional ideas?

Thanks.
 
I would try something like this: Write an event handler for the Radio Button CheckChanged event to handle all of your radio buttons. Then, modify the Tag property of the panel:

Code:
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged, RadioButton2.CheckedChanged, etc.
Dim rb As RadioButton
Dim p As Panel
rb = sender
p = rb.Container
Select Case rb.Text
       Case "Yes"
                p.Tag = "1"
       Case "No"
                p.Tag = "2"
       Case "N/A"
                p.Tag = "3"
End Select
End Sub

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top