public static void ShowForReplace(TextEditor editor, bool findMode) { if (theDialog == null) { theDialog = new FindReplaceDialog(editor); theDialog.tabMain.SelectedIndex = findMode ? 0 : 1; theDialog.Show(); theDialog.Activate(); } else { theDialog.tabMain.SelectedIndex = findMode ? 0 : 1; theDialog.Activate(); } if (!editor.TextArea.Selection.IsMultiline) { theDialog.txtFind.Text = theDialog.txtFind2.Text = editor.TextArea.Selection.GetText(); theDialog.txtFind.SelectAll(); theDialog.txtFind2.SelectAll(); theDialog.txtFind2.Focus(); } }