problems with text boxes calls

How can I say to VB to re-open the same text box when user put in this txtbox something wrong?
Ie. :
if txtBox.Text < 20 then [reenter the value in the same text box]

tnx for help Settima.
settimaAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
MarineConnect With a Mentor Commented:
Actually its recommended to use Validate EVent of the textbox to ensure that the user input is valid. If so then proceed with the rest of the program. If not then the focus stays on the textbox till the user makes appropriate changes to it.
0
 
anthonycCommented:
I'm confused to what you are asking.... but you can use txtBox.setfocus to set the cursor back into that window
0
 
VbmasterCommented:
The best solution would probably to add a private variable to your form, and add the check in the KeyUp event. If the action is okay the private variable is set to be equal the txtBox.Text, if it's not just set txtBox.Text = {the private variable}.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
SonalCommented:
Settima,hope you are using VB6.o..

put your validation code in the validate event of the text box and if the validation does'nt go thro' succesfully put either a msg box or setfocus to the same text box ...or set cancel = true..
 
0
 
SonalCommented:
Settima,hope you are using VB6.o..

put your validation code in the validate event of the text box and if the validation does'nt go thro' succesfully put either a msg box or setfocus to the same text box ...or set cancel = true..
 
0
 
vbWayneCommented:
or..
if cint(textbox.text) < 20 then
  msgbox "Sorry, need a number greater than 20. Please enter a correct number."
textbox.text = ""
textbox.setfocus

end if
0
All Courses

From novice to tech pro — start learning today.