Reputation: 21
I have problem with richBox1 text disabling.
I've tryed richTextBox1.readonly = true;
and richTextBox1.Enabled = false;
My code:
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
richTextBox1.ReadOnly = !richTextBox1.ReadOnly;
}
Its disabling after one letter.
EDIT: And if disable I can still copy text but cant write there.
Upvotes: 0
Views: 57
Reputation: 305
Honestly, disabling expected functionality is not something you should be doing. It is not good UI design.
Upvotes: 1
Reputation: 30022
The event TextChanged
is fired every time the text changes (including writing or removing one letter). You can use Form's Load event (by double clicking the form on design time) :
private void Form1_Load(object sender, EventArgs e)
{
richTextBox1.ReadOnly = true;
richTextBox1.Enabled = false;
}
Upvotes: 0