John Cassell
Well-known member
- Joined
- Mar 20, 2007
- Messages
- 65
- Programming Experience
- Beginner
Hi,
I am having a problem with one of my forms and was hoping someone could help..
It is a login form and when someone has entered their password and pressed Enter it should either a) log them in or b) tell them their password is wrong.
This works ok but when the msgbox comes up to say 'Incorrect Password' the user presses Enter (as they would do naturally) only to be presented with the msgbox again saying 'Incorrect Password'. To avoid this they need to press the space bar or use the mouse which I would prefer them not to do. My code is below any help would be appreciated..
I am having a problem with one of my forms and was hoping someone could help..
It is a login form and when someone has entered their password and pressed Enter it should either a) log them in or b) tell them their password is wrong.
This works ok but when the msgbox comes up to say 'Incorrect Password' the user presses Enter (as they would do naturally) only to be presented with the msgbox again saying 'Incorrect Password'. To avoid this they need to press the space bar or use the mouse which I would prefer them not to do. My code is below any help would be appreciated..
VB.NET:
Private Sub PasswordTextBox_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles PasswordTextBox.KeyUp
If e.KeyCode = Keys.Enter Then
LoginProcedure() ' Which checks the password etc and displays msgbox if needed
End If
End Sub