Solved

Set TextBox color

Posted on 2008-10-06
11
1,213 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: 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!

 

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

739 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