about colors and numbers

A

Alex D.

can anybody tell me how to assign a color as a number? I couldnt find
anything for that in System.Drawing.
Example of what I need to do:
TextBox1.BackColor = "#A8D3FF";

Thanks,
Alex.
 
L

Lucas Tam

can anybody tell me how to assign a color as a number? I couldnt find
anything for that in System.Drawing.
Example of what I need to do:
TextBox1.BackColor = "#A8D3FF";


I believe you'll need to convert the colour into RGB first.., and then use
System.Drawing.Color.FromArgb
 
L

Lucas Tam

can anybody tell me how to assign a color as a number? I couldnt find
anything for that in System.Drawing.
Example of what I need to do:
TextBox1.BackColor = "#A8D3FF";


or try System.drawing.color.fromname... that might work too
 
S

S. Justin Gengo

Alex,

You should use the ColorTranslator's FromHtml Method:

TextBox1.BackColor = System.Drawing.ColorTranslator.FromHtml("#00ff00");


--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top