' Mr. Minich
' Period 1
' Ch5Demo2
' 12/7/2000
' Purpose - to illustrate the use of the Trim and UCase functions
Option Explicit
Private Sub Form_Load()
' checks user's password sets the appropriate display messages
Dim strPassword As String
strPassword = InputBox("Enter password: ")
If ((Trim(UCase(strPassword))) <> "MINICH") Then
MsgBox "Incorrect Password!"
cmdExit_Click
End If
lblHello.Caption = "You've been granted permission to run this program."
cmdExit.Caption = "E&xit"
End Sub
Private Sub cmdExit_Click()
' unloads the form and ends the program
Unload Me
End
End Sub
' The use of the UCase function allows users to type a password
' in uppercase or lowercase. The use of the Trim function allows the user
' to type leading and trailing spaces around the password.