467,116 Members | 1,165 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,116 developers. It's quick & easy.

RichTextBox and Find

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
Nov 17 '05 #1
  • viewed: 5448
Share:
2 Replies
"Steve Barnett" <no****@nodomain.com> wrote:
[...] It looks like RichTextBoxFinds.Reverse
always starts from the end of the rich text box.


Apparently, you need to swap two of the parameters.

See http://tinyurl.com/d6xff

P.
Nov 17 '05 #2
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

"Paul E Collins" <fi******************@CL4.org> wrote in message
news:dk**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
"Steve Barnett" <no****@nodomain.com> wrote:
[...] It looks like RichTextBoxFinds.Reverse
always starts from the end of the rich text box.


Apparently, you need to swap two of the parameters.

See http://tinyurl.com/d6xff

P.

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Martin Dew | last post: by
2 posts views Thread by Neo Chou | last post: by
3 posts views Thread by michael sorens | last post: by
2 posts views Thread by lizii | last post: by
4 posts views Thread by =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.