c#: How to change the Back color of the Disabled TextBox control

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ssknov
    New Member
    • Dec 2007
    • 40

    c#: How to change the Back color of the Disabled TextBox control

    hi
    I am using Textbox contrl which is disabled for some conditions.
    I would like to make the Textboxes back color as white as it looks when it is enabled? Can u pls help how to change its back color?


    Thank u
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Once you enable the textbox its back color will automatically changed to default white.

    Comment

    • ssknov
      New Member
      • Dec 2007
      • 40

      #3
      hi das
      sorry my question was wrong,
      though it was disabled it should be in white color?

      now i did it thanku.

      for others following code may help

      this.txtUserNam e.BackColor = System.Drawing. SystemColors.Co ntrolLightLight ;

      cheers
      kssk

      Comment

      • ilyaostr
        New Member
        • Sep 2008
        • 1

        #4
        Couldn't you just set it's ReadOnly property to true?

        Comment

        • Plater
          Recognized Expert Expert
          • Apr 2007
          • 7872

          #5
          If this is a windows application, just set the background color like normal and it works:
          [code=c#]
          tbinput.Enabled = false;
          tbinput.BackCol or = Color.Red;
          [/code]

          If it is a web application, changes it's style element's backgroundcolor

          Comment

          Working...