CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 1999
    Posts
    102

    how to hideselection in rich text box, through code

    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


  2. #2
    Join Date
    May 1999
    Location
    Omika, Japan
    Posts
    729

    Re: how to hideselection in rich text box, through code

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured