Solved

How to find a color

Posted on 2011-02-10
6
202 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 500 total points
ID: 34864072
Try

Color.FromName("SteelBlue")
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 56

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

635 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