Click to See Complete Forum and Search --> : how to hideselection in rich text box, through code


mikledet
November 24th, 1999, 12:31 AM
Hi,
I wander if anyone can suggest a way to hide the highlighting from a selected text - but without an additional click - that is - thorough code.
I know the property -> HideSlection = true will do it - but only after the text box will lose focus -
So, I guess what I need is shifting focus from the text box to another control and then back to the text box - but through code.
Hope I am clear enough.
Thanks,
Dani

Ravi Kiran
November 24th, 1999, 01:56 AM
I dont understand your question!.
Incidentally, even if you move to other control and comeback (to the same textbox/RTB,) the selection info is retained.

So, if you have 2 text boxes one with HideSelection = True and other with HideSelection = False, and suppose you selected some text in both, (to complete the picture add 2 more btns,) and if you tab thru, you will notice that the selection information is retained!. ie. when the focus comes back to the txt box with HDS=False and before loosing focus it had some text selected, it automatically selects that text on Gotfocus . That's what it revealed in my tests!.

So now: in this scinario: what do you want to do?!...

Just for shifting focus you could use Control.SetFocus.
But then... when and more imp. why?

You can try to set the .SelLenth to 0 to remove the highliting

RK