Login Form with If Else in VB .Net, Windows Application Form | Visual Studio 2022

This article will include steps on how to create a login form in VB .Net by using Windows Application Form environment. I won’t be using any database for this user/pass validation but just two variables that will hold the credentials.

Yes, Database is must whenever you wanna store information but this is just to help you learn deceleration of variables and how to use If Else, and you will be able to authenticate without database.

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

        Dim uname As String
        Dim upass As String

        uname = txtname.Text
        upass = txtpass.Text

        If uname = "navdeep" And upass = "ethanhunt" Then
            MsgBox("Login Successful!")
            MsgBox("Login Failed!")
        End If

    End Sub

Leave a Reply