Set Insertion point in a textbox with a selection.
Posted on 1998-12-01
Has anyone ever noticed that when you use the SelStart and SelLength properties of a textbox, the caret (insertion point) is always to the right of the selection? It is possible to manually put the insertion point at the beginning of the selection. For example, hold the shift key down and hit the left arrow a couple times. But I want to do this programatically. Have all the text selected with the caret at the beginning, not the end. Now I'm not looking for a hack answer like use SendKeys or the like. I could make it work with a hack myself. I want to know how it's really done... Using the API, sending message(s) or perhaps I'm just totally missing something with the control's properties. It's seems that a simple way the control COULD give the functionality would be to set the SelStart and then have a negative SelLength. Unfortunately, SelLength will not take a negative number. hmmm...