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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Position cursor within textbox data with setfocus?

Status
Not open for further replies.

michellecole

Programmer
Feb 12, 2004
42
0
0
US
Is there a way to position the cursor within a textbox? For instance, when a user clicks the "Add" button, a textbox is auto populated with the first 9 characters of an ID; the user enters the remaining 4. But the cursor is positioned at the left of the text in the textbox instead of the right where the user really needs to be to begin entering.

I've tried not to use a setfocus and rely on tab order but it places cursor at the left instead of the right.

I also formatted the text box to right justify, but again the cursor is placed to the left.

Any ideas?

Thank you,
Michelle
 
Try this:

Text1.SetFocus
text1.selStart = Len(text1.Text)


Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top