Hello Guys
What I am trying to do is some validation after the user presses the enter key on a text box. I tried putting the validation routine in the Lost Focus
of the textbox. What happens next is very frustrating, the next textbox
receives focus automatically The code will display a message in a message box that the contents of the textbox is invalid and then set focus back to the original textbox Now the lostfocus event of the next textbox is fired and now I am stuck in a loop.
In the Keypressed event of he form (with KeyPreview = True), I check to see if the return key has been pressed then do a Sendkey {TAB} so that when the user presses the enter key on the textbox, focus will be set to the next textbox.
I tried doing the validation in the Keypressed event of the TextBox
and that seems to work just fine, but I cannot trap for when the user presses
the Tab key to move to the next textbox.
Is there some way that I can trap for the TAB key being pressed within the form
or can anyone out there suggest a different approach???
Thank You
Gary
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only