Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

How can I make my richTextBox search case insensitive? C#

$
0
0

I have a WinForms application with a search feature on another form within the application.

Currently, I can search with the find form, but it is case-sensitive.

With the following code:

int index = 0;
            string temp = Basic_Word_Processor.Instance.richTextBoxPrintCtrl1.Text; 
            Basic_Word_Processor.Instance.richTextBoxPrintCtrl1.Text = "";
            Basic_Word_Processor.Instance.richTextBoxPrintCtrl1.Text = temp;
            while (index < Basic_Word_Processor.Instance.richTextBoxPrintCtrl1.Text.LastIndexOf(textBox1.Text))
            {
                Basic_Word_Processor.Instance.richTextBoxPrintCtrl1.Find (textBox1.Text, index, Basic_Word_Processor.Instance.richTextBoxPrintCtrl1.TextLength, RichTextBoxFinds.None);
                Basic_Word_Processor.Instance.richTextBoxPrintCtrl1.SelectionBackColor = Color.Yellow;
                index = Basic_Word_Processor.Instance.richTextBoxPrintCtrl1.Text.IndexOf(textBox1.Text, index) +1;

How can I perform case-insensitive searches?

Thanks in advance. :-)

--EDIT--

This is the code from the "Search" button. 


Viewing all articles
Browse latest Browse all 12583

Trending Articles