all groups > visual studio .net general > october 2005 >
You're in the

visual studio .net general

group:

RichTextBox and Find


Re: RichTextBox and Find Paul E Collins
10/30/2005 12:00:00 AM
visual studio .net general: [quoted text, click to view]

Apparently, you need to swap two of the parameters.

See http://tinyurl.com/d6xff

P.

RichTextBox and Find Steve Barnett
10/30/2005 10:25:02 AM
I have a rich text box that I'm trying to search for information. I want to
be able to search from the end of the text towards the start, so my first
Find method looks like:

RTBedit.Find(TextToFind, RTBedit.Text.Length, RichTextBoxFinds.Reverse);

This finds the last occurrence of TextToFind in the rich text box perfectly
well. I then want to go on to find the next occurrence towards the start of
the text, so I code:

RTBedit.Find(TextToFind, RTBedit.SelectionStart - 1,
RichTextBoxFinds.Reverse);

What I expected to see was the next occurrence highlighted. However, this
code ALWAYS highlights the same occurrence as the first find. It's not
searching backwards at all.It looks like RichTextBoxFinds.Reverse always
starts from the end of the rich text box.

Have I misinterpreted something here? I thought the RichTextBoxFinds.Reverse
was supposed to search backwards from the start position.

Any suggestions.

Thanks
Steve

Re: RichTextBox and Find Steve Barnett
10/31/2005 9:02:46 AM
How painfully logical.

Thanks, it's working fine now and so much more efficiently than my
workaround using IndexOf and ToLower to get a case insensitive find.

Steve

[quoted text, click to view]

AddThis Social Bookmark Button