private void wrapHtml(){ string textboxData = string.Empty; string selectedText = string.Empty; string htmlTagOpen = ""; string htmlTagClosed = ""; textboxData = textBox1.Text; selectedText = textBox1.SelectedText; textBox1.Text = textboxData.Replace(selectedText, htmlTagOpen + selectedText + htmlTagClosed);}