Click to See Complete Forum and Search --> : How do I change the properties of a text box so the user cannot input text?


TheBigHam
January 13th, 2009, 06:30 AM
Hi All,

I am using C# visual express edition to code a windows form application. I have a text box, the user enters a string then presses a button on the form. I then want the text box to become inactive so the user cannot click on the text box and edit the information?

What is the code to change the text box to make it inactive? Any help would be much appreciated.

Thanks.......

dannystommen
January 13th, 2009, 06:34 AM
use the ReadOnly or Enabled property


textBox1.ReadOnly = true;

//or use this
textBox1.Enabled = false;

TheBigHam
January 13th, 2009, 07:07 AM
Thanks mate- that works perfectly................