locked
How to disable a textbox control and not have it grayed? RRS feed

  • Question

  • In MS Access, I can set a textbox enable property equal to True and set its locked property equal to True thereby prohibiting input into the textbox without having the textbox grayed.  How can I get the same effect with a textbox or other controls in C#?

    REvans


    • Edited by REvans611 Wednesday, January 16, 2013 1:34 PM
    • Moved by CoolDadTx Wednesday, January 16, 2013 3:21 PM Winforms related
    Wednesday, January 16, 2013 1:34 PM

Answers

  • Revans : You can try this in form load event.

     
    textbox1.ReadOnly = true;
    textbox1.BackColor = Color.White;


    • Proposed as answer by CoolDadTx Wednesday, January 16, 2013 3:20 PM
    • Marked as answer by Bob Wu-MT Thursday, January 24, 2013 7:50 AM
    Wednesday, January 16, 2013 1:54 PM