Click to See Complete Forum and Search --> : help displaying colors


Robbo99
March 27th, 2004, 05:44 PM
thanks for you help coolbiz but I don't think it is quite right.
If you had the code

Dim Zone1_color As Color = Color.Red

the colour red is to be stored as Zone1_color as well as to be outputed in a label to say Red so if i change the value of Zone1_colour to Blue then it would also change what is displayed in the label to "blue".
Thanks guys

Craig Gemmill
March 28th, 2004, 12:50 PM
You can use:

label1.text = "You selected " & label1.BackColor.ToKnownColor.ToString

But keep in mind that two things need to stay consistent for this to work:

1) It has to be a "KnownColor". A KnownColor is one that is a member of the Color enums.

2) You MUST set the color using a color enum.
Label1.BackColor = Color.Whatever