Link to home
Start Free TrialLog in
Avatar of dotnet0824
dotnet0824

asked on

Set TextBox color

Hi,
I would want to set the Textbox backColor using code
txtCustomer.BackColor = "&H80000005"; //I want to set this value

System.Drawing.SystemColors can be used . But how can this value be set  "&H80000005"
Avatar of p_davis
p_davis

You can you try to use the ColorTranslator Class

just ColorTranslator. // and you will see your options.
You can use the ColorTranslator function like this:

Color c = System.Drawing.ColorTranslator.FromHtml(H80000005);
try

txtCustomer.BackColor = System.Drawing.Color.FromArgb(&H80000005)
Avatar of dotnet0824

ASKER

txtCustomer.BackColor = System.Drawing.Color.FromArgb(&H80000005)
(this accepts int only so error)

txtCustomer.backColor =  System.Drawing.ColorTranslator.FromHtml(H80000005);
Doesnot Work throws error
what is that color value from? what format?
and what was the error that you received from the colortranslator class.?
also, if it is html you need double quotes around the value because the FromHtml method takes a string.

When I assign
txtCustomer.backColor =  System.Drawing.ColorTranslator.FromHtml("H80000005");
ERROR : Control does not support transparent background colors.
ASKER CERTIFIED SOLUTION
Avatar of p_davis
p_davis

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
Hi Davis,
I tried that out with NO LUCK  :-(    This has become highly important . Points increased to max -500
SOLUTION
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