473,396 Members | 1,766 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,396 software developers and data experts.

highlight every found string in a richtextbox C#

Hello - I have this simple code that highlights THE FIRST string found,
but NOT ALL strings in the richtextbox. Can anybody suggest an easy way
to hightlight all strings (caseless as well) in the richtxtbox? If you
have a regex example that would be even better.
private void toolStripMenuItem2_Click(object sender, EventArgs e)
{
int x;
x = richTextBox1.Find(textBox1.Text);
richTextBox1.SelectionStart = x;
richTextBox1.SelectionLength = textBox1.Text.Length;
richTextBox1.SelectionBackColor = Color.YellowGreen;
}

Aug 29 '06 #1
0 1272

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Cox | last post by:
How would I go about highlighting text in a textbox?
2
by: Hariharan Subramony | last post by:
Hello Guys, I have an important issue and need solution at the earliest. Thanks in advance. I have a RichTextBox named say, ' rtb' that has the text "Hello, I am fine." To place it in the...
2
by: Juan | last post by:
I`m inserting strings in a rich text control using the AppendText method, I would like to change certain parts of the string so, for example, a certain word appears bold and red when inserted. Is...
5
by: Atara | last post by:
I am trying to convert the following code to VB .Net, I still have some gaps (the lines that are marked with (*)) and also I need an ending condition for the while loop. any help would be...
1
by: Kuups | last post by:
Hello there, How can I highlight the partical word in a string w/o using any of the event just the code itself just like for example.. The big brown fox.. Just want to highlight the word...
2
by: Karl Groves | last post by:
Just wondering if anyone out there has a good function to highlight code. PHP's highlight_string function chokes whenever the string contains certain characters. Most of the functions I've found...
0
by: Franky | last post by:
I have a MDI form open and two child forms open in it. Each of the children contains a usercontrol which contains a richtextbox. The topmost form's caption bar is highlighted but I click on the...
3
by: =?Utf-8?B?QnJpYW4gQ29vaw==?= | last post by:
In my project I want to search thru a text in a text box or RichTextBox. When I search I want to list all lines that contain the string I am searching for. e.g. one plus four two plus four...
2
by: Torben Laursen | last post by:
I have a problem with showing text in a richtextbox I want to show 3 columns of data and want them to be aligned. I make sure each string for each column is the same length but since different...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.