|
Post by Roger Cabo on May 17, 2020 13:31:48 GMT 1
Hi everyone, does anyone know how to select text in a textbox? So it became blue selected.. eg: ed1.Text = " ABCDEFGHI" ed1.SelStart = 4
ed1.SelLength= 3
Does not work.
Thank you..
|
|
|
Post by scalion on May 24, 2020 16:49:37 GMT 1
Hi, You must write ed1.SetFocus before setting SelStart and SelLength, then it work. Have good day
|
|
|
Post by Roger Cabo on Jan 1, 2021 0:24:53 GMT 1
Hi, You must write ed1.SetFocus before setting SelStart and SelLength, then it work. Have good day Yes thank you.. If you always set the focus previously to another object, then you can realize colors text at any position. Without this ugly scrolling to to the current position.
frm1.SetFocus // set to anywhere
dim oldpos% = rtf1.SelStart
rtf1.SelStart = 100 rtf1.SelLength = 100 rtf1.SelColor = RGB(100,200,255) rtf1.SelLength = 0 rtf1.SelStart = oldpos%
rtf1.SetFocus // get the focus back This prevents the cursor jumping around in the rtf1 control.
|
|