Hi guys,

Im learning VB.NET and as a first task im creating a login form. ive been trying to link it to another form once a correct username and password are entered. however, despite that i still cant be able to hide it or unload it once the next form is loaded

Here is the Code

Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
        If UsernameTextBox.Text = "chris" And PasswordTextBox.Text = "chrispass" Then
            Me.Hide()
            Form2.Show()

        End If

        Me.Close()
    End Sub

The Form2 appears as coded above but the 'Me.Hide()' manages to hide the login form but then it appears again

Some input pls?

No problem here having a New Project with 2 Forms and using this code.

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.Hide()
        Form2.Show()
    End Sub
End Class

Form1 hides and Form2 shows, nothing else.

i've just tried that but it doesnt work - the form closes but appears again

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.