Advertisement
sethmodz

Simple Login Form In VB.Net

Nov 1st, 2017
623
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.07 KB | None | 0 0
  1. 'Simple Login Form Without A Database, Coded In VB.Net.
  2. 'Make Sure You Set The Shutdown Mode To "When Last Form Closes."
  3. 'Create All Buttons And Rename Main Form To "mainForm.vb" And This Form
  4. 'To "loginForm.vb" Before Putting This Code In Or You Will Get Errors!
  5. 'IMPORTANT: This Isn't "Secure" So People Can Still Bypass It, Use At Own Risk.
  6. '┏┓╋╋┏┓
  7. '┃┗┓┏┛┃
  8. '┗┓┃┃┏╋━━┳━━┓
  9. '╋┃┗┛┃┃┏┓┃┏┓┃
  10. '╋┗┓┏┛┃┗┛┃┃┃┃
  11. '╋╋┗┛╋┃┏━┻┛┗┛
  12. '╋╋╋╋╋┃┃
  13. '╋╋╋╋╋┗┛
  14. 'Login Form.
  15. Public Class loginForm
  16.     Private Sub loginButton_Click(sender As Object, e As EventArgs) Handles loginButton.Click
  17.         If UsernameBox.Text = "vpn" And PasswordBox.Text = "vpn" Then 'If Statement For Login. Change To Desired Login Information.
  18.             MessageBox.Show("Thanks for logging in, vpn", "Success")
  19.             My.Forms.mainForm.Show()
  20.             My.Forms.loginForm.Close()
  21.         ElseIf Attempts = 3 Then 'This Is For Setting Max Amount Of Attempts Before Application Is Closed.
  22.             MessageBox.Show("You Have Reached The Maximum Number Of Allowed Attempts. Exiting The Application...", "Too Many Attempts")
  23.             Application.Exit()
  24.         Else 'This Happens If The Username Is False.
  25.             PasswordBox.Clear()
  26.             Attempts += 1
  27.             MessageBox.Show("Incorrect Password!", "Error")
  28.         End If
  29.     End Sub
  30.  
  31.     'Integers Here
  32.     Dim Attempts As Integer = 0
  33.  
  34.     Private Sub hidePassword_CheckedChanged(sender As Object, e As EventArgs) Handles hidePassword.CheckedChanged
  35.         If hidePassword.Checked = True Then 'This Hides The Input In The Password Box.
  36.             PasswordBox.UseSystemPasswordChar = True
  37.         Else
  38.             PasswordBox.UseSystemPasswordChar = False
  39.         End If
  40.     End Sub
  41.  
  42.     Private Sub registerButton_Click(sender As Object, e As EventArgs) Handles registerButton.Click
  43.         MessageBox.Show("Contact @VpnThaGod On Instagram To Be Registered!", "Register")
  44.     End Sub
  45. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement