Ulrich
Thu Sep 11 05:42:11 CDT 2003
Hi Herfried,
w32api.SendMessage( this.TextBox1.Handle, (int)w32api.EditControlMsg.EM_SETSEL, 7, 3 );
should place the "anchor point" at pos 7 and the caret at pos 3, according to the W32 SDK, but either the this wrong or the DotNET
framework adds another level of logik to the framework textbox: The caret is still on the right hand side of the selection.
Thus, your hack seems to be the only working solution.
Thanks,
ulli
"Herfried K. Wagner [MVP]" <hirf.nosp@m.activevb.de> schrieb im Newsbeitrag news:#MZbgJ9dDHA.904@TK2MSFTNGP11.phx.gbl...
> Hello,
>
> "Ulrich Sprick" <nospam.ulrich.sprick@gmx.de> schrieb:
> > how can select some text in the textbox, but have the caret
> > on the LEFT side of the selection? You can do that with
> > the mouse by drawing the mouse cursor from right to left
> > over some text. But how can it be done programmatically?
>
> Quick and *very* dirty:
>
> \\\
> Me.TextBox1.Focus()
> Me.TextBox1.SelectionStart = 6
> Me.TextBox1.SelectionLength = 0
> SendKeys.Send("+{LEFT 4}")
> ///
>
> --
> Herfried K. Wagner
> MVP · VB Classic, VB.NET
>
http://www.mvps.org/dotnet
>
>