Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cursor Placement in Textbox 3

Status
Not open for further replies.

sterlecki

Technical User
Oct 25, 2003
181
0
0
US
How can I force the cursor to be placed at the beginning of a textbox? For instance, in textbox where a date or telphone number has to be entered with an input mask ie.
(###)###-#### or a date **/**/**** if the user clicks on an empty text box the cursor doesn't go to the beginning of the field but is positioned at the point of insertion.

I would like the cursor to be placed in the left most position if the textbox is empty so the user can start typing immediately and be able to fill the input mask from start to finish.
 
Hi

Try looking at .SelStart in help it may enable you to do what you are trying to do

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Didn't find that topic in help.
If you just tab or enter and move to a cell you can control where the cursor is but I haven't found anything about whenyou click on a field.
 
Will this do what you're looking for?

Private Sub Text0_Click()
Text0.SelStart = 0
End Sub

For some reason, putting the statement in the _GotFocus event doesn't work but instead puts the cursor wherever you click at.
 
Thanks Dave. I know this is an old post but I was getting nowhere trying to use selstart in the _Enter event (although I HAVE got it to work previously on a different form). Have a belated star!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top