i know this sound stupid however im using a while loop for a password enter type thing and i want so that if u enter the password 3 time wrong then the program will close. But all my loop wnt let me type in the password three time it only lets my do it once and then closing the program is there anything that i maby left out??
Dim user As String
Dim password As String
Dim counter As Short
password = "vangough"
user = "pp01"
counter = 0
While counter < 3
If txtuserid.Text = user Then
If txtpassword.Text = password Then
'Text Boxes (Password Page)'
txtuserid.Visible = False
txtpassword.Visible = False
'Buttons (Password Page)'
btnlogin.Visible = False
'Labels (Password Page)'
lbluserid.Visible = False
lblpassword.Visible = False
lbltitle.Visible = False
'Text Boxes (Main Page)'
'Room Details'
txtrheight.Visible = True
txtrwidth.Visible = True
txtrlength.Visible = True
'Window Details'
txtwheight.Visible = True
txtwwidth.Visible = True
'Door Details'
txtdheight.Visible = True
txtdwidth.Visible = True
'Buttons(Main Page)'
btnconfirm.Visible = True
'Labels (Main Page)'
'Room Details'
lblroom.Visible = True
lblrheight.Visible = True
lblrwidth.Visible = True
lblrlength.Visible = True
'Window Details'
lblwindow.Visible = True
lblwheight.Visible = True
lblwwidth.Visible = True
'Door Details'
lbldoor.Visible = True
lbldheight.Visible = True
lbldwidth.Visible = True
'Paint'
lblpaint.Visible = True
lblpainttype.Visible = True
'Picboxs (Main Page)'
'Paint'
picbxwhite.Visible = True
picbxmagnolia.Visible = True
picbxsun.Visible = True
picbxapple.Visible = True
picbxraspberry.Visible = True
picbxsea.Visible = True
'check boxes' (Main Page)
'Paint'
ckbxwhite.Visible = True
ckbxmagnolia.Visible = True
ckbxsun.Visible = True
ckbxapple.Visible = True
ckbxraspberry.Visible = True
ckbxsea.Visible = True
ckbxmatt.Visible = True
ckbxsilk.Visible = True
ckbxsatin.Visible = True
'Help Menu' (Main Page)
logout.Visible = True
clear.Visible = True
Else
counter = counter + 1
'Error message for incorrect password'
MsgBox("The PASSWORD you have entered seems to be incorrect")
End If
Else
counter = counter + 1
'Error message for incorrect userID'
MsgBox("Sorry this USER ID is not registered to this computer")
End If
End While
Dim user As String
Dim password As String
Dim counter As Short
password = "vangough"
user = "pp01"
counter = 0
While counter < 3
If txtuserid.Text = user Then
If txtpassword.Text = password Then
'Text Boxes (Password Page)'
txtuserid.Visible = False
txtpassword.Visible = False
'Buttons (Password Page)'
btnlogin.Visible = False
'Labels (Password Page)'
lbluserid.Visible = False
lblpassword.Visible = False
lbltitle.Visible = False
'Text Boxes (Main Page)'
'Room Details'
txtrheight.Visible = True
txtrwidth.Visible = True
txtrlength.Visible = True
'Window Details'
txtwheight.Visible = True
txtwwidth.Visible = True
'Door Details'
txtdheight.Visible = True
txtdwidth.Visible = True
'Buttons(Main Page)'
btnconfirm.Visible = True
'Labels (Main Page)'
'Room Details'
lblroom.Visible = True
lblrheight.Visible = True
lblrwidth.Visible = True
lblrlength.Visible = True
'Window Details'
lblwindow.Visible = True
lblwheight.Visible = True
lblwwidth.Visible = True
'Door Details'
lbldoor.Visible = True
lbldheight.Visible = True
lbldwidth.Visible = True
'Paint'
lblpaint.Visible = True
lblpainttype.Visible = True
'Picboxs (Main Page)'
'Paint'
picbxwhite.Visible = True
picbxmagnolia.Visible = True
picbxsun.Visible = True
picbxapple.Visible = True
picbxraspberry.Visible = True
picbxsea.Visible = True
'check boxes' (Main Page)
'Paint'
ckbxwhite.Visible = True
ckbxmagnolia.Visible = True
ckbxsun.Visible = True
ckbxapple.Visible = True
ckbxraspberry.Visible = True
ckbxsea.Visible = True
ckbxmatt.Visible = True
ckbxsilk.Visible = True
ckbxsatin.Visible = True
'Help Menu' (Main Page)
logout.Visible = True
clear.Visible = True
Else
counter = counter + 1
'Error message for incorrect password'
MsgBox("The PASSWORD you have entered seems to be incorrect")
End If
Else
counter = counter + 1
'Error message for incorrect userID'
MsgBox("Sorry this USER ID is not registered to this computer")
End If
End While