Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Form Text Boxes - Copy format of text boxes NDBC Excel Discussion (Misc queries) 3 July 2nd 09 02:02 AM
Validation list boxes not working Helen0610 Excel Discussion (Misc queries) 1 August 23rd 07 03:22 PM
validation combo boxes not working steve alcock Excel Worksheet Functions 2 May 29th 05 06:21 PM
Drop-down boxes stopped working Dave Excel Discussion (Misc queries) 1 April 4th 05 06:13 PM
Tab between Text Boxes no longer working Scott Excel Programming 1 October 2nd 03 04:27 AM


All times are GMT +1. The time now is 10:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"