How do i make textbox unselectable ?

I have readonly textboxes on my form ... how do i make them unselectable ... so that editing cursor does not apear in those textboxes when i click on them


Answer this question

How do i make textbox unselectable ?

  • Robert Jeppesen

    As Cablehead said you should set Enabled and/or ReadOnly to false.  A TextBox is the best way to go when you want the user to be able to select the text but not edit it.  Labels can't be selected at all that is why most modern error dialog use text boxes.  I think even MessageBox now uses a text box.  The difference between the 2 properties is important.  Enabled prevents selection and interaction completely.  ReadOnly permits selection but prevents interaction.  If you want the text box to act like a label then you'll need to drop the border and change the background color as well.

    Michael Taylor - 10/24/05

  • jagadishk_msft

    you could convert the text boxes to labels.



  • stibitz

    Set the ReadOnly or Enabled property.

  • jameswilson

    TextBox.Enable = false;

  • How do i make textbox unselectable ?