Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Validation VB 5.0
Message
From
20/06/2001 18:30:27
 
 
To
All
General information
Forum:
Visual Basic
Category:
Other
Title:
Validation VB 5.0
Miscellaneous
Thread ID:
00521712
Message ID:
00521712
Views:
40
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
Map
View

Click here to load this message in the networking platform