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

  • Thread starter Thread starter CRGreathouse
  • Start date Start date
AI Thread Summary
In C# development using MS Visual Studio, there is a need for a multiline text box that supports standard multiline features while restricting input to plain text. The default TextBox does not allow for functionalities like Ctrl + A, while the RichTextBox allows formatted text, which is undesirable. The discussion revolves around finding the best solution to achieve a plain text multiline input. Options include enhancing a multiline TextBox to include missing features or modifying a RichTextBox to filter out unwanted formatting. The conversation seeks to identify the most efficient approach to meet these requirements, highlighting the lack of a native widget that combines both functionalities.
CRGreathouse
Science Advisor
Homework Helper
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?
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top