Solved

Set TextBox color

Posted on 2008-10-06
11
1,202 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
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

830 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