Why does textbox text appear faded when 'enable' propery is set to false?

Recommended Answers

So you have visual feedback that you cannot type into it.

Jump to Post

This happens because when controls are disabled they are forced to look "faded".

It's built inside of Windows Controls by default. It's not your application's fault.

Jump to Post

All 6 Replies

Member Avatar

This happens because when controls are disabled they are forced to look "faded".

It's built inside of Windows Controls by default. It's not your application's fault.

So is there a way that I can have a result of calculations in a textbox which is not 'faded'?

Member Avatar

Yes, there is a way.
Instead of using the 'enabled' property, use the read-only property. Read-only property removes support for users being able to type in the text box. You can however assign text by code.

And even if it is read only you can still set the background colour to anything you want. Or you could just use a label control.

Thanks all

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.