Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1238
  • Last Modified:

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"
0
dotnet0824
Asked:
dotnet0824
2 Solutions
 
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
 
appariCommented:
try

txtCustomer.BackColor = System.Drawing.Color.FromArgb(&H80000005)
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
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
 
gdpotterCommented:
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now