If the question is how to hard-code multiple names, just add additional Case
statements:
Select Case txtUsername.Text
Case "Tom"
If txtPassword.Text = "nkp12345" Then
blnEnter = True
End If
Case "Dick"
If txtPassword.Text = "abc99009" Then
blnEnter = True
End If
Case "Harry"
If txtPassword.Text = "qwe66766" Then
blnEnter = True
End If
Case Else:
End Select
If you're asking how to avoid hard coding the usernames and passwords so any
Tom, Dick or Harry can use the system, you'll have to resort to saving the
valid usernames and passwords in a text file or the registry, and based on
the username entered, load the pw to check and go from there.
--
Randy Birch
MVP Visual Basic
http://www.mvps.org/vbnet/
Please respond only to the newsgroups so all can benefit.
"nkp" <we***********@btinternet.com> wrote in message
news:bo**********@sparta.btinternet.com...
: I wish to enable more than one named user to access password protected
: menu ie: Tom,Dick and Harry rather than JUST Tom.
: Can I do this with Case Select...doesn't seem work for me.
: Assistance much appreciated.
:
:
: Private Sub cmdOk_Click()
: Dim blnEnter As Boolean
: Static intCount As Integer
: blnEnter = False
: intCount = intCount + 1
: lblAttempt.Caption = intCount
:
: Select Case txtUsername
: Case "Tom"
:
: If txtPassword = "nkp12345" Then
: blnEnter = True
: End If
: End Select
:
: If blnEnter = True Then
: Unload Me
: frmMenu.Show
: Else
: If intCount >= 3 Then
: MsgBox "you have exceeded your 3 attempts"
: Unload Me
: End If
: End If
: End Sub
: