none
How do i make textbox unselectable ? RRS feed

  • Question

  • 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
    Saturday, October 22, 2005 8:43 PM

Answers

All replies

  • you could convert the text boxes to labels.

    Sunday, October 23, 2005 2:02 AM
    Moderator
  • Set the ReadOnly or Enabled property.
    Sunday, October 23, 2005 10:30 PM
  • 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
    Monday, October 24, 2005 11:53 AM
    Moderator
  • TextBox.Enable = false;
    Monday, October 24, 2005 3:20 PM