Hi,

I have my program all programmed but,
i want to have only one button!
How can i make it so if the radio button is selected it will do a certain sector of the code when the the actual button is pressed iv had a good attempt at if - A fail attempt but heres what i did

if RadioButton2.Checked = False Then
*my Code Here*
End if 

If RadioButton1.Checked = False Then
*my Code Here*
End if

Recommended Answers

All 4 Replies

Hi,

You can try something like this:

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged, _
    RadioButton2.CheckedChanged
        If RadioButton1.Checked Then
            MsgBox("You clicked Radiobutton1")
        End If
        If RadioButton2.Checked Then
            MsgBox("You clicked Radiobutton2")
        End If
    End Sub

Hi,

You can try something like this:

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged, _
    RadioButton2.CheckedChanged
        If RadioButton1.Checked Then
            MsgBox("You clicked Radiobutton1")
        End If
        If RadioButton2.Checked Then
            MsgBox("You clicked Radiobutton2")
        End If
    End Sub

Worked Great Now i have another problem if you like to check out my other thread now :S

Hi,

You could mark this thread as solved.

Done thanks for all your help!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.