• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 221
  • Last Modified:

Return the correct color with a string

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.

Thanks.

Frank
0
The_Kingpin08
Asked:
The_Kingpin08
  • 2
1 Solution
 
The_Kingpin08Author Commented:
Ok found it with the "FromName" method of the Color function.
0
 
bramsquadCommented:
       Dim myColor As String = "blue"
        Me.Button3.BackColor = System.Drawing.Color.FromName(myColor)

~b
0
 
bramsquadCommented:
shoot.

too late
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now