Reputation: 2943
I have a notes program that I use to document cases while working, however when I copy and paste data from other windows it pastes it in with the formating from the site. Is there a setting for rich text boxes (and text boxes in general) that will remove any formatting and put only the text into the textbox? If not can do I have to use a method that looks at the clipboard contents and sends the string to a specific font/size etc?
Upvotes: 1
Views: 3388
Reputation: 28325
You should be able to get the unformatted string by specifying the TextDataFormat and set it to Text
:
var stringToPasteIn = Clipboard.GetText(TextDataFormat.Text);
Or letting the RichTextBox
do it for you automagically using its DataFormats options:
DataFormats.Format myFormat = DataFormats.GetFormat(DataFormats.Text);
richTextBox1.Paste(myFormat);
Upvotes: 1