switching forms

hello i am making a password protected program and i need to switch between 2 different forms. 1 is the login page. once password is entered i need to go to the main page. wich is called form2. heres my code i hope you can help.

 

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim Password As String

Password = InputBox("Please enter the password")

If (Password = "happygilmore") Then

what has to go here to go to form2

Else

MsgBox("Incorrect Password!")

End If

End Sub

End Class



Answer this question

switching forms

  • Wouss

    Try this:
    Dim f2 As New Form2
    f2.Show()

    You need to decide what you're going to do with the Form1 instance. You can hide it for later use. Or you can close it. In the latter case: Project + properties, Application tab, Shutdown mode = When last form closes. Yet another approach is to make Form2 your startup form and display Form1 with ShowDialog() in the Load event.


  • Mitch5713

    Usually the Web does this for you with redirections.

    Yours is a really strange way to do it but if you must:

    webBrowser.navigate("HaqpyGillmoresURL.com")



  • MFaucett

    that dosn't even make sense buddy. and i didn't say anything about using the web...

    i'm just navigating forms


  • Vj5

    thanks allot for the response i have it working now. i owe you 1.
  • switching forms