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

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

Member Avatar for deletedaccount

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 for deletedaccount

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.