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

Keeping cursor position in text box 1

Status
Not open for further replies.

IjumpOverU

Technical User
Jul 31, 2003
43
US
I have a control that uses the base textbox control. On the text changed event I do some validation and sometime changed the text that was entered. However when I do this it always sets the cursor in the text box to the beginning of the test (even if the last character was entered at the end or in the middle). This causes some problems if you want to type multiple keystrokes after the validation happens.

Is there anyway to keep the cursor position or look it up and restore it after the validation?

Any help or ideas are appreciated!
 
Have a look at the SelectionLength and SelectionStart properties.


Hope this helps.

[vampire][bat]
 
I found those properties in the object browser just as I got your response. It looks like that might work! Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top