I have a form to accept some input from the user. a textbox which allow user to keep in idno has a keyup even to capture the enter key. after the user press enter, a validateIDNO function will verify the idno and return true or false. when return false, a msgbox will appear with a OK button. Afterwhich the focus goes back to the textbox.
Private Sub tbxIDNO_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tbxIDNO.KeyUp
if e.KeyCode = Keys.Enter Then
if (validateIDNO(tbxIDNO.text)) then
'go to another form
e.handled = true
this seem to work fine. however when a invalid idno is inputed, the msgbox pop up. when I press enter key to close the msgbox. the event handler will capture the enter key and verify the idno again. which will again show me a pop up box with message "Invalid IDNO".
my program assume the user doesn't have a mouse and can only use the keyboard to work. anyone know how to solve this problem? the program should allow the user to key in the idno again after closing the msgbox.