How To Convert RichTextBox to String (WPF)

Nadeemshaik
Posted by Nadeemshaik under C# category on | Points: 40 | Views : 1871
 public string ConvertRichTextBoxContentsToString(System.Windows.Controls.RichTextBox rtb)
{
try
{
TextRange textRange = new TextRange(rtb.Document.ContentStart,
rtb.Document.ContentEnd);
return textRange.Text.ToString().Trim();
}
catch (Exception ex)
{
//

}
return null;
}

Comments or Responses

Login to post response