Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I make my richTextBox search case-insensitive?
    text
    copied!<p>I am making a word processor. The word processor has a facility which allows the user to search the richTextBox for text.</p> <p>Currently, my "find" code consists of:</p> <pre><code>using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Basic_Word_Processor { public partial class Find : Form { public Find() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { 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 &lt; 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; { } } } private void Find_FormClosing(object sender, FormClosingEventArgs e) { Basic_Word_Processor.Instance.richTextBoxPrintCtrl1.SelectionBackColor = Color.White; } } } </code></pre> <p>However, if the richTextBox contains the word "TEST", and the user searched for "test", no results would be found.</p> <p>I asked the same question on the MSDN forum, but I was told to convert the textBox and richTextBox ToLower, which worked, but it made the text in the richTextBox lower case. I do not want it to change the actual text in the richTextBox.</p> <p>Any suggestions? </p> <p><strong>EDIT</strong> </p> <p>The textBox is on the Find form and the richTextBox is on the Basic_Word_Processor form.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload