Whenever I do richtextbox1.Clear()
it says the method doesn't exist. And it's pretty much the only solution I get, everywhere I go.
I've tried looking for a Text
property, and I've tried to look through the Document
property as well, but to no avail.
What I am missing? The box needs to be cleared, like you can do with a textbox.Clear()
call.
您可以使用richTextBox.Document.Blocks.Clear();
清除RichTextBox richTextBox.Document.Blocks.Clear();
If you are adding some controls into the richTextBox (eg below):
LinkLabel link = new LinkLabel();
richTextBox1.Controls.Add(link);
you have to use
richTextBox1.Controls.Clear();
to remove all controls.
为Windows Forms执行此操作的正确方法是执行richTextBox.ResetText();
You could just do richTextBox.Text = "";
, too.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.