Solved

Set TextBox color

Posted on 2008-10-06
11
1,168 Views
Last Modified: 2012-05-05
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
Comment
Question by:dotnet0824
11 Comments
 
LVL 22

Expert Comment

by:p_davis
ID: 22649446
You can you try to use the ColorTranslator Class

just ColorTranslator. // and you will see your options.
0
 

Expert Comment

by:AGION
ID: 22649584
You can use the ColorTranslator function like this:

Color c = System.Drawing.ColorTranslator.FromHtml(H80000005);
0
 
LVL 39

Expert Comment

by:appari
ID: 22649585
try

txtCustomer.BackColor = System.Drawing.Color.FromArgb(&H80000005)
0
 

Author Comment

by:dotnet0824
ID: 22651572
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
 
LVL 22

Expert Comment

by:p_davis
ID: 22652059
what is that color value from? what format?
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 22

Expert Comment

by:p_davis
ID: 22652065
and what was the error that you received from the colortranslator class.?
0
 
LVL 22

Expert Comment

by:p_davis
ID: 22652074
also, if it is html you need double quotes around the value because the FromHtml method takes a string.
0
 

Author Comment

by:dotnet0824
ID: 22652262

When I assign
txtCustomer.backColor =  System.Drawing.ColorTranslator.FromHtml("H80000005");
ERROR : Control does not support transparent background colors.
0
 
LVL 22

Accepted Solution

by:
p_davis earned 250 total points
ID: 22652278
0
 

Author Comment

by:dotnet0824
ID: 22654589
Hi Davis,
I tried that out with NO LUCK  :-(    This has become highly important . Points increased to max -500
0
 

Assisted Solution

by:gdpotter
gdpotter earned 250 total points
ID: 22655518
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now