Hi,
I am trying to make a quiz and i want it so, that if you get the correct answer you go to the next form and close the previous one but if not, it will make pop-up box that goes back to the question when pressed OK. Here is what i have so far:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If (TextBox1.Text = "yes") Then Form3.Show() Else 
        MessageBox.Show("Try Again", "Incorrect", MessageBoxButtons.OK, MessageBoxIcon.Information)

Any help would be greatly appreciated!

To hide and to show forms use
Form1.Hide()
Form2.Show()
I think this code will help you :I made a little change ...

Public Class Form1
    Dim msgans As String

    Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = "Yes" Then
            Me.Hide()
            Form2.Show()
        Else

            msgans = MsgBox("Yes to Try Again , No to quit ..", MsgBoxStyle.Critical + MsgBoxStyle.YesNo, "Warning ")
            If msgans = vbYes Then
                'load that function used to start current question
            Else
                End

            End If
        End If
    End Sub
End Class

Hi,
I am trying to make a quiz and i want it so, that if you get the correct answer you go to the next form and close the previous one but if not, it will make pop-up box that goes back to the question when pressed OK. Here is what i have so far:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If (TextBox1.Text = "yes") Then Form3.Show() Else 
        MessageBox.Show("Try Again", "Incorrect", MessageBoxButtons.OK, MessageBoxIcon.Information)

Any help would be greatly appreciated!

Your click event is calling the same form to show, this is why you are seeing the same form pop up. You should declare a new instance of your form to show and close the existing one (if that is what you want.

for instance

If TextBox1.Text = "yes" Then 
    Dim frm As New Form3 '(are you trying to show the same form repeatedly?)
   frm.Show
   Me.Close
End If

Using End instead of calling the forms close method is obselete and not recommended in .Net

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.