Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Easy control question
Message
 
To
26/06/2001 06:41:13
Jimi Lee
Pop Electronic Products Ltd.
Hong Kong, Hong Kong
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00523448
Message ID:
00523453
Views:
8
This message has been marked as the solution to the initial question of the thread.
Hi!
Place your code in Valid event instead of LostFocus and return 0 or .F. on error to prevent losing focus.
if val(this.value)<0 or val(this.value)>3 then
  messagebox("Value must be 0-3", 16)
  this.value=""
  return 0
endif
>Hello everyone,
>
>I used the following code in a textbox's lostfocus event to ensure the user input 0-3 for it. If the value isn't 0-3, I want the program to empty the textbox and set foucus on it. I used the following code:
>
>
>if val(this.value)<0 or val(this.value)>3 then
>  messagebox("Value must be 0-3", 16)
>  this.value=""
>  this.setfocus()
>endif
>
>
>but the setfocus() just not working, after the messagebox only the next object of the textbox get the focus. What should I do to prevent this?
>
>Thanks a lot!
Previous
Reply
Map
View

Click here to load this message in the networking platform