How to enable copy when textbox.enabled is false?

Ýou may try this if you want the user to allow copy paste:

textBox1.ReadOnly = true;

From MSDN forum

In the context of a TextBox, readonly allows the user to set focus to and select and copy the text but not modify it. A disabled TextBox does not allow any interaction whatsoever.

Use ReadOnly when you have data that you want the user to see and copy, but not modify. Use a disabled textbox, when the data you are displaying is not applicable in for the current state of a dialog or window.


You should set your textboxes to ReadOnly = true instead of Enabled = false if you want to support copy/paste.


textBox1.ReadOnly = true;

you can even use a copy button and code as follows:

System.Windows.Forms.Clipboard.SetText(textBox1.Text);

Tags:

C#

Winforms