I have a TextBox
control and want to be able to copy content of TextBox
.
Properties of TextBox
look like this;
textBox1.Enabled = false;
textBox1.ReadOnly = false;
I cannot copy content of textBox1 even though ReadOnly property is false.
Is there any suggestion?
Ý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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With