I have two radio btuttons which link me to another form but they have failed to likk me to the forms i directhem to link me to.
i dont know if ther is any problem with my code this is the code. some one to help me

Dim one As boolean
Dim two As boolean

If one = True Then frmone.Show
Else 
If two = True Then frmsec.Show
Else
me.hide

End if

Recommended Answers

All 6 Replies

But how you set the value of the boolean variables ?

See if this helps.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If RadioButton1.Checked Then MsgBox("RadioButton1 is Checked.")
        If RadioButton2.Checked Then MsgBox("RadioButton2 is Checked.")
    End Sub

First declare your forms in your main form public class.

Dim showForm2 As New Form2
Dim showForm3 As New Form3

Then in your button click event set your if statements to show which form you need.

If RadioButton1.Checked = True Then
   showForm2.Show()
End If
If RadioButton2.Checked = True Then
   showForm3.Show()
End If

Declaring a boolean for this project is redundant because the radio button in itself
is a boolean.

Hope this Helps

P.S If you want people to be able to help you to the best of their abilities please
be sure to post as much of your own source Code as possible otherwise it's pretty difficult to understand what you really want.

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged

     Form2.Show()
     
    End Sub

Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged

     Form3.Show()
     
    End Sub

This would be the simplest one. Just Try this one.

thank you then let me try it out
Am sorry am new to the language so i keep testing my self

thank you the code worked am looking forward to produce the best

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.