private void btReplace_Click(object sender, EventArgs e) { try { if (tb.SelectionLength != 0) if (!tb.Selection.ReadOnly) tb.InsertText(tbReplace.Text); btFindNext_Click(sender, null); } catch (Exception ex) { MessageBox.Show(ex.Message); } }