Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Working with text boxes!!
Hi,
I have created a form in which there are three textboxes. I have added some conditions to these textboxes which are triggered by exit event. Now when the user enters a wrong data into the textbox a message box pops up and instructs the correct info that should be entered into the box. Everything seems well so far, unless what I need to happen next is the contents the textbox in which we have the incorrect data to be selected and the user wouldnt have to do it by pushing some extra unnecessary key strokes. I thought by setfocus property this could be done. But it did not work. Now could anyone tell me if there is an alternative way. TNx, eqbal -- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Working with text boxes!!
Hi
try with me.textbox1 ..setfocus ..selstart=0 ..sellength=len(.value) end with "Eqbal Vkilzadeh" wrote: Hi, I have created a form in which there are three textboxes. I have added some conditions to these textboxes which are triggered by exit event. Now when the user enters a wrong data into the textbox a message box pops up and instructs the correct info that should be entered into the box. Everything seems well so far, unless what I need to happen next is the contents the textbox in which we have the incorrect data to be selected and the user wouldnt have to do it by pushing some extra unnecessary key strokes. I thought by setfocus property this could be done. But it did not work. Now could anyone tell me if there is an alternative way. TNx, eqbal -- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Working with text boxes!!
Eqbal,
Try this Private Sub TextBox1_exit(ByVal Cancel As MSForms.ReturnBoolean) If TextBox1 < "Your condition" Then MsgBox "Incorrect Data Entered" & vbLf & "Please Try Again" Cancel = True With TextBox1 .SelStart = 0 .SelLength = Len(.Text) End With End If End Sub Neil "Eqbal Vkilzadeh" wrote in message news:opshl9n7g8w6rab0@eqbal... Hi, I have created a form in which there are three textboxes. I have added some conditions to these textboxes which are triggered by exit event. Now when the user enters a wrong data into the textbox a message box pops up and instructs the correct info that should be entered into the box. Everything seems well so far, unless what I need to happen next is the contents the textbox in which we have the incorrect data to be selected and the user wouldn't have to do it by pushing some extra unnecessary key strokes. I thought by setfocus property this could be done. But it did not work. Now could anyone tell me if there is an alternative way. TNx, eqbal -- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/ |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Working with text boxes!!
If you only have one textbox in an userform, why is it necessary to als install a command button and put any error testing in the private codin for the command button? If you have two or more textboxes in an userform, is it necessary t have a command button, also? Chuckles12 -- Chuckles12 ----------------------------------------------------------------------- Chuckles123's Profile: http://www.excelforum.com/member.php...fo&userid=1494 View this thread: http://www.excelforum.com/showthread.php?threadid=31441 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
User Form Text Boxes - Copy format of text boxes | Excel Discussion (Misc queries) | |||
Validation list boxes not working | Excel Discussion (Misc queries) | |||
validation combo boxes not working | Excel Worksheet Functions | |||
Drop-down boxes stopped working | Excel Discussion (Misc queries) | |||
Tab between Text Boxes no longer working | Excel Programming |