Link to home
Start Free TrialLog in
Avatar of kiranboi
kiranboi

asked on

Changing a TextBox BackColor at runtime

I have a series of TextBoxes on my form and I want to be able to programatically change their Back Color to the 'Control' system color.
If I set the color in the control properties at design time it works fine but if I try to set it using:
txtboxInvoiceToCode.BackColor = System.Drawing.Color.FromKnownColor(KnownColor.Control)
during runtime all it does is change the BackColor where the text is and leaves the rest of the control's BackColor as white.
Can someone tell me how I can change this properly.
Thanks
ASKER CERTIFIED SOLUTION
Avatar of theGhost_k8
theGhost_k8
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kiranboi
kiranboi

ASKER

Its used in a custom Sub
Ahh, ive sorted it. The TextBox had its ReadOnly property set to True. For some reason this seems to effect changes to the BackColor.
Thanks for answering me tho, Ill give you the points anyway
eazyest points ever....