private void button1_Click(object sender, EventArgs e) { try { string str = FindTextBox.Text; if (LastSearched == str) { FindPos = EditWindow.Find(str, FindPos + LastSearched.Length, RichTextBoxFinds.None); LastSearched = str; } else { FindPos = EditWindow.Find(str, 0, RichTextBoxFinds.None); LastSearched = str; } EditWindow.SelectionStart = FindPos; EditWindow.ScrollToCaret(); EditWindow.Select(FindPos, LastSearched.Length); EditWindow.Refresh(); } catch (Exception x) { MessageBox.Show(x.Message); } }