473,395 Members | 1,571 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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
2 5891
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Martin Dew | last post by:
I have a RichTextBox called rtbOutput. I am adding lines of text using the AppendText method. What I want to do is immediately after adding this line of text make sure that this line of text is...
2
by: Neo Chou | last post by:
Greetings! I'm trying to make my ASPX page able to process WORD format document. I learned that RichTextBox might help me, but I can't use it either by adding it to my Web Control list or by...
1
by: gabe | last post by:
I am looking for a way to mimic some of the functionality of a web page without writing html (or I am looking to someone to point out something really obvious that I am over looking) Currently I...
4
by: D. Yates | last post by:
Hi, When a RichTextBox control doesn't have focus, it DOES NOT scroll to the last line that is added; however, if it does have focus, it WILL scroll to the last line added. I want to stop and...
0
by: Vincent | last post by:
Dear all, I have implemented a class to export the content of RichTextBox to image in WYSISYG mode so that line breaks on the screen are the same as exported. C# Code: public struct...
3
by: michael sorens | last post by:
The documentation for the RichTextBox is sketchy at best. I want to do a very simple task but I cannot find information on this. I am using a RichTextBox as an output window. Some text I want to...
2
by: lizii | last post by:
At the moment i am trying to write into a richtextbox using the Rtf call from another richtextbox. However realising that richtextbox do not have multithreading - i know i need to invoke this...
1
by: Andrus | last post by:
I need to save font selected by user by Ctrl+MouseWheel in Winforms RichTextBox. I tried override below but this does not remember font: in this method Font.Size property seems to be always...
4
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I have a multiline RichTextBox that I use for data logging. I'm concerned about how the AppendText method reacts when over time the maximum number of characters have been added. Do the...
5
by: Andrus | last post by:
I use Winforms RichTextBox control to edit scripts. Scripts are plain ascii texts. When error occurs, script engine returns character position of error in code as integer. How to position...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.