VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



password examples

by Steve G (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (2 Votes)

This code shows three different samples of using low security password entry to a form. Yes this is quick, easy and some might think somewhat lame but for beginners these samples will be just fine and useful. It keeps prying eyes out of my stuff anyways. These code examples can easily be modified for more sophisticated routines. It just lays a basic foundation is all.

Inputs
'Just change the passwords to whatever you want
Assumes
'N/A
Code Returns
'N/A
Side Effects
'No side effects
API Declarations
'None

Rate password examples

'This is just one of the examples showing a 
'low security way to hard code form entry with 
'a username and double password entry to the form.
'
'
'
Option Explicit
Public LoginSucceeded As Boolean
Private Sub Form_Load()
  Me.Caption = "Monkey Login "
End Sub
Private Sub cmdCancel_Click()
  LoginSucceeded = False
  Unload Me
End Sub
Private Sub cmdOK_Click()
Dim Pw1 As String '
Pw1 = "monkey" 'first password
'check combo box for population. If nothing
'return a msgbox dialog
If cmoUserName = "" Then
  MsgBox ("Type a Username")
Else
'Then check for first password
If txtPassword = Pw1 Then
'If correct password found go to verify second
Password2
End If
End If
End Sub
Private Function Password2()
Dim PW2 As String '
PW2 = "boy" 'second password
'check validity of second password
'then check if all correct, if so, load form
If txtPassword2 = PW2 Then
  LoginSucceeded = True
  MsgBox ("Access granted!")
  frmAbout.Show
  Unload Me
Else
'if only one password is correct and other empty
'remind user two passwords are needed
  MsgBox "You need both passwords to enter this program"
End If
End Function

Download this snippet    Add to My Saved Code

password examples Comments

No comments have been posted about password examples. Why not be the first to post a comment about password examples.

Post your comment

Subject:
Message:
0/1000 characters