Solved

Set TextBox color

Posted on 2008-10-06
11
1,191 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

776 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