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"
dotnet0824Asked:
Who is Participating?
 
p_davisCommented:
You can you try to use the ColorTranslator Class

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

Color c = System.Drawing.ColorTranslator.FromHtml(H80000005);
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
appariCommented:
try

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

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

When I assign
txtCustomer.backColor =  System.Drawing.ColorTranslator.FromHtml("H80000005");
ERROR : Control does not support transparent background colors.
0
 
dotnet0824Author Commented:
Hi Davis,
I tried that out with NO LUCK  :-(    This has become highly important . Points increased to max -500
0
 
gdpotterConnect With a Mentor Commented:
Unfortunatly, you cannot have translucent text boxes in Visual Basic, notice if you take off the last two digits it works fine but there's no transparency, that's because it's Red, Green, Blue and Alpha.
The best way to solve this is to use something that isn't acutally a text box.  Check out:
http://www.codeproject.com/KB/edit/alphablendtextbox.aspx
You would then set the back color of the AlphaBlendTextBox to black, and the BackAlpha to 5.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.