Microsoft Visual Studio – How to set forecolor of textbox when control is set programatically to readonly

I have found that if my textbox control is set to ReadOnly= True at design time, I can change the forecolor programmatically without a hitch.

If my textbox control is set to ReadOnly = False at design time, and then decide to change the ReadOnly = True programmatically, if I then try and change my forecolor it doesn’t work.


In this case, the framework won’t allow the ForeColor change unless you first change the BackGround color, which sets some flag that allows the ForeColor to be changed.

Please follow and like us: