Advertisement
2_2002-2004 Miscellaneous #114175

[ Password Protection With Up To 3 Attemps ]

This will ask the user to enter a password and if it is incorrect it will give them two more chances (three attempts in total). Please vote and leave comments :)

AI

KI-Zusammenfassung: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Quellcode
original-source
Private Sub Command1_Click()
  Dim Password As String
  Dim InputPassword As String
  Dim Attempt As Integer
  Password = "Secret"
  Attempt = 0
  Do
    InputPassword = InputBox("Enter password. This is attempt number " & Attempt & ".")
    Attempt = Attempt + 1
  Loop Until (Attempt = 3) Or (InputPassword = Password)
  If InputPassword = Password Then
    MsgBox ("This password is valid!")
  Else
    MsgBox ("This password is invalid!")
  End If
End Sub
Originalkommentare (3)
Wiederhergestellt von der Wayback Machine