public static Regex Execute() { using (FindDialog dialog = new FindDialog()) { if (dialog.ShowDialog() == DialogResult.OK) { return(dialog.Regex); } return(null); } }
private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.Control && e.KeyCode == Keys.F) { e.Handled = true; Regex regex = FindDialog.Execute(); if (regex != null) { _findRegex = regex; FindNext(0); } } else if (e.KeyCode == Keys.F3) { FindNext(textBox1.SelectionStart + 1); } }