How to Restrict Content to Plain Text in a RichTextBox in Visual Studio?

  • Thread starter Thread starter CRGreathouse
  • Start date Start date
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
0 replies · 3K views
Messages
2,832
Reaction score
0
I'm working in C#, but my question applies, I think, to all of the MS Visual Studio.

For many programs that I write, I want a multiline text box that supports usual multiline features (TextBox doesn't let you use Ctrl + A, for example). But I also want to restrict the contents to plain text.

Now with a RichTextBox I can continually replace the contents with the plaintext version, but then formatted text still appears on a paste, for example. I want to avoid that. What's the best way of doing that?

Ideally there would be a widget that does that natively. Otherwise, would it be better/easier to change a TextBox to multiline and program in all the missing features, or try to block the things I don't want somehow from a RichTextBox? Or is there a third possibility I've missed?