mjsr
mjsr

Reputation: 7590

Disable edition in a TextBox with Scrolling enabled

i would like to know if it is possible to disable the edition of a textbox without losing the scrolling capability. If the Enabled property is set to false then the scroll bars are also disabled

Upvotes: 9

Views: 16595

Answers (3)

Assis Runny
Assis Runny

Reputation: 1

Is easy to do that you just must to

// set readonly property true
ReadOnly = True;

// set cursor property to default
Cursor = Default;

// change focus when it has on enter event
private void textBox4_Enter(object sender, EventArgs e)
{
    label8.Focus();
}

Upvotes: 0

Michael Buen
Michael Buen

Reputation: 39393

Try:

textBox1.ReadOnly = true;

Disable text selection:

 ContextMenu blankContextMenu = new ContextMenu();
 textBox1.ContextMenu = blankContextMenu; 

For disabling Ctrl+C and Ctrl+V, capture them on KeyDown event

Upvotes: 24

KillerX
KillerX

Reputation: 1466

You may want to try the readonly property.

Upvotes: 3

Related Questions