PDA

Click to See Complete Forum and Search --> : Write Password


alwsid
Mar 10th, 2000, 03:56 PM
Hello there...

How to make a text.box password prompt only
3 times after that if the users have enter wrong
password the program will close.

Chris
Mar 11th, 2000, 02:12 AM
First set the PasswordChar to * in the Textbox properties, then

Option Explicit
Dim Att_Cnt As Integer

Private Sub Form1_Load()
Att_Cnt = 0
End Sub

Private Sub Command1_Click()
If StrComp(Text1,"<Your Password>,vbBinaryCompare) <> 0 Then
If Att_Cnt < 3 Then
' Increase the counter
Att_Cnt = Att_Cnt + 1
Text1.SetFocus
Else
' Close the Program
End
End If
Else
' Load your application here.
End If
End Sub

Private Sub Text1_GotFocus()
Text1.SelStart = 0
Text1.SelLength = Len(Text1)
End Sub

Is this all you need? :)

alwsid
Mar 13th, 2000, 01:53 PM
Thanks Chris...

Yes thats what I need.

alwsid
Mar 14th, 2000, 04:28 PM
Sorry Chris about that, I'm not familiar with MsChart control and never use that.
Hopefully you can ask our Bulletin Board members and could help you.

Thanks again.