Search And Highlight Text In Rich TextBox in C# winform app
Search And Highlight Text In Rich TextBox In C# Winform
Hello friend’s this is Rashid Hussain come with another video tutorial. In this tutorial I’ll show you how to Search and Highlight text In Rich TextBox In C# Winform Application
Create new windows Form application in visual studio. follow the steps
drag richTextBox ,textbox and Button from tool box.
Page the Code below on Button_Click Event
private void button1_Click(object sender, EventArgs e) { int index = 0; richTextBox1.SelectAll(); richTextBox1.SelectionBackColor = Color.White; while (index<richTextBox1.Text.LastIndexOf(textBox1.Text)) { richTextBox1.Find(textBox1.Text,index,richTextBox1.TextLength,RichTextBoxFinds.MatchCase); richTextBox1.SelectionBackColor = Color.Yellow; index = richTextBox1.Text.IndexOf(textBox1.Text,index)+1; } }
Video tutorial
Thank you for reading this article. Please don’t forget to subscribe our official YouTube Channel RashiCode