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

x
?
Solved

How to find a color

Posted on 2011-02-10
6
Medium Priority
?
204 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
[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
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 2000 total points
ID: 34864072
Try

Color.FromName("SteelBlue")
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!

 
LVL 59

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

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!

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

688 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