Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Set TextBox color

Posted on 2008-10-06
11
Medium Priority
?
1,231 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
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!

 

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

What is a Denial of Service (DoS)?

A DoS is a malicious attempt to prevent the normal operation of a computer system. You may frequently see the terms 'DDoS' (Distributed Denial of Service) and 'DoS' used interchangeably, but there are some subtle differences.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

670 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