Return the correct color with a string

Posted on 2004-11-04
Last Modified: 2010-04-23
Hi all,

I'd like to set the backcolor of a label to a certain color. The problem is that the color is represented in a string format in a variable. Is there any way I could convert it or do something ?

For exemple, I have a var myColor as string which as the value "Red" and I'd like to set the backcolor to the variable's value.


Question by:The_Kingpin08

    Author Comment

    Ok found it with the "FromName" method of the Color function.
    LVL 8

    Accepted Solution

           Dim myColor As String = "blue"
            Me.Button3.BackColor = System.Drawing.Color.FromName(myColor)

    LVL 8

    Expert Comment


    too late

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
    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 (…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    728 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

    15 Experts available now in Live!

    Get 1:1 Help Now