Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. C#: How to change the color of a disabled textbox?

C#: How to change the color of a disabled textbox?

Scheduled Pinned Locked Moved C#
csharphelptutorialquestion
9 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kssknov
    wrote on last edited by
    #1

    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

    senthil

    P K X V 5 Replies Last reply
    0
    • K kssknov

      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

      senthil

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      Please don't repost a question just to push it back to the top of the forums. This isn't good.

      Deja View - the feeling that you've seen this post before.

      My blog | My articles

      K 1 Reply Last reply
      0
      • P Pete OHanlon

        Please don't repost a question just to push it back to the top of the forums. This isn't good.

        Deja View - the feeling that you've seen this post before.

        My blog | My articles

        K Offline
        K Offline
        kssknov
        wrote on last edited by
        #3

        sorry i actually never meant to repost to make it visible at top! it was my net problem. since when processing slowed i pressed the post button twice. kssk

        senthil

        P 1 Reply Last reply
        0
        • K kssknov

          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

          senthil

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          Probably the easiest way to do this is for you to derive your own control from the textbox and handle the different background colour in there.

          Deja View - the feeling that you've seen this post before.

          My blog | My articles

          1 Reply Last reply
          0
          • K kssknov

            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

            senthil

            K Offline
            K Offline
            Kalvin Work
            wrote on last edited by
            #5

            Not sure if this is an option for your particular situation or not. When I need behavior like this I set the textbox to readonly instead of disabled. That way I can modify the backcolor. txtBox.ReadOnly = true; txtBox.BackColor = System.Drawing.Color.White; Hope this helps.

            1 Reply Last reply
            0
            • K kssknov

              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

              senthil

              X Offline
              X Offline
              Xmen Real
              wrote on last edited by
              #6

              man, it quite easy, just change backcolor to White from Windows

              Becoming Programmer...

              1 Reply Last reply
              0
              • K kssknov

                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

                senthil

                V Offline
                V Offline
                V 0
                wrote on last edited by
                #7

                I thought you could set a textbox to ReadOnly and Enabled. ReadOnly would leave the BackColor to white, while Enabled would set it gray. you can always set the BackColor to virtually any Color you want after you've set it ReadOnly or Enabled Hope this helps.

                V.
                Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

                D 1 Reply Last reply
                0
                • V V 0

                  I thought you could set a textbox to ReadOnly and Enabled. ReadOnly would leave the BackColor to white, while Enabled would set it gray. you can always set the BackColor to virtually any Color you want after you've set it ReadOnly or Enabled Hope this helps.

                  V.
                  Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

                  D Offline
                  D Offline
                  Dan Neely
                  wrote on last edited by
                  #8

                  IIRC read only allows you to select text, disabled does not.

                  Otherwise [Microsoft is] toast in the long term no matter how much money they've got. They would be already if the Linux community didn't have it's head so firmly up it's own command line buffer that it looks like taking 15 years to find the desktop. -- Matthew Faithfull

                  1 Reply Last reply
                  0
                  • K kssknov

                    sorry i actually never meant to repost to make it visible at top! it was my net problem. since when processing slowed i pressed the post button twice. kssk

                    senthil

                    P Offline
                    P Offline
                    Paul Conrad
                    wrote on last edited by
                    #9

                    kssknov wrote:

                    it was my net problem. since when processing slowed i pressed the post button twice.

                    Hey, it happens :)

                    "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups