Simple Login Form in Visual Basic.Net

Simple Login Form in Visual Basic.Net
  • Version
  • Download 317
  • File Size 327.91 KB
  • Create Date March 3, 2016

Simple Login Form in Visual Basic.Net

This is a simple login form that has no database. The program compares the value entered by the user to the value assigned to username and password field.

A step by step tutorial on how to create a login program in vb.net, source code can also be downloaded.

Source code:

Public Class Form1

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox1.Clear()
        TextBox2.Clear()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = "" Then
            MessageBox.Show("Please enter username")
            TextBox1.Focus()
            Exit Sub
        ElseIf TextBox2.Text = "" Then
            MessageBox.Show("Please enter password")
            TextBox2.Focus()
            Exit Sub
        End If

        If TextBox1.Text = "admin" And TextBox2.Text = "admin" Then
            MessageBox.Show("welcome admin")
        Else
            MessageBox.Show("incorrect username or password")
        End If

    End Sub

    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        If CheckBox1.Checked = True Then
            TextBox2.PasswordChar = ""
        Else
            TextBox2.PasswordChar = "*"
        End If
    End Sub
End Class
, , ,

Post navigation

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.