How To Make A Simple Login In VB.NET

A login form is a form which is used to give access to other form for instance lets take you have a login form and you have two textboxes in login form and a button so if your username textbox and password textbox text is correct then when you click the button you will have access to other forms

make a new form and make another form as well now go to form1 and add two textbox and a button now change the textproperty of button to login now make the form look like this


you can add labels and make the form look good now its time to code


double click your form1 and add this code

Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = "admin" And TextBox2.Text = "admin " Then
            Me.Hide()
            form2.show()
        Else
            MsgBox("username or password incorrect")
        End If
    End Sub
End Class

          
change the username admin and password admin if you want this is just a simple one