Solved

How to find a color

Posted on 2011-02-10
6
190 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Zoom web page in asp.net 2 35
WPF issue with Trigger 2 66
regex to allow alphanumeric characters and \ 2 22
System32Int Error 8 44
This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
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 …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 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

11 Experts available now in Live!

Get 1:1 Help Now