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

Edit Boxes and SelStart

Status
Not open for further replies.

ezpzjohn

Programmer
Jun 29, 2001
50
GB
Hi Everyone

I am having a problem with the SelStart property in an edit box.

I have an edit box on a form in which text is entered. I am using the SelStart property to be able to insert text at the cursor position.

Everything is fine until you insert one or more carriage returns. If you then click anywhere outside the edit box (e.g. to access another control) the cursor position (SelStart) jumps several characters to the right.

Anyone have any idea how to overcome this erratic behaviour?

JOHN
 
I'm not sure why you'd necessarily expect the cursor position to go back to just where you wanted it when you go away from an editbox and then back. I suppose you could keep track of the SelStart and SelLength values via the lostfocus event and then reset the values when the editbox gets the focus back. But I expect it would need some tweaking to get it to work right.

Dave Dardinger
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top