Solved

How to find a color

Posted on 2011-02-10
6
192 Views
Last Modified: 2012-05-11
I have a Visual Basic 2008 Windows form. I have a text string that contains "SteelBlue". How do I set the forecolor of a text control to Color.SteelBlue?
Thanks,
pat
0
Comment
Question by:mpdillon
6 Comments
 
LVL 8

Expert Comment

by:pdd1lan
ID: 34863986
Me.TextBox1.ForeColor = Color.SteelBlue
0
 

Author Comment

by:mpdillon
ID: 34864039
pdd1Ian,
I do not think that is what I asked. I agree that Color.SteelBlue can be used to set the forecolor. But I don't have a COLOR variable. I have a text string, "SteelBlue". Don't I have to use a For Each statement to find a match between the COLOR.Name and the Text string, "SteelBlue"?
pat
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 34864072
Try

Color.FromName("SteelBlue")
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 51

Expert Comment

by:HainKurt
ID: 34864098
try:

dim myColorName as String = "SteelBlue"
Me.TextBox1.ForeColor = Color.FromName(myColorName)
0
 

Author Closing Comment

by:mpdillon
ID: 34864129
CodeCruiser, Thank you. That worked for me.
Dim clr As Color = Nothing
clr = Color.FromName("SteelBlue")
me.Textbox1.forecolor = clr
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 34869717
Glad to help :-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

910 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

22 Experts available now in Live!

Get 1:1 Help Now