>I have an application with a required field. The information is entered with a textbox control. In the lostfocus event of the textbox there is code to make sure that the information is valid. What I need to do if the information entered is not valid is reset the focus back to the textbox. Right now the focus goes to the next control in the screen. How do I fix this?
>
>Any ideas?
>
>Jim
Jim
You have two choices, 1) put the code in teh Valid and if the field is not good return 0, or 2) in the Lostfocus if the field is not good issues This.SetFocus followed by NODEFAULT.
Personally, I think using the Valid is the better design because the prupose of the valid is to determine if you will allow the user to leave the control, the purpose of the LostFocus is to react to the user leaving the control.