> Can anyone tell me the correct syntax when using a variable to control
the color property?
This works ok:
If ABC2flash Then Label61.BackColor = Color.Yellow
This doesn't, showing syntax error in source code:
Dim ABC1col As String = "Color.Yellow"
If ABC2flash Then Label61.BackColor = ABC1col
I don't use VB.NET myself (see the note at the end of this posting), but
I think I can guess at your problem. The BackColor property is a number
(in VB6 it would be a Long, but I'm not sure of the data type in VB.NET,
you'll have to look that up in your help files). You have defined
ABC1col as a String variable and are trying to assign a String variable
to a property requiring a numerical data type... hence, your error. Try
this (substituting the correct data type where I used <NumericDataType>
as a place holder):
Dim ABC1col As <NumericDataType> = Color.Yellow
If ABC2flash Then Label61.BackColor = ABC1col
Now, for the note I told you about...
Almost everybody in this newsgroup is using VB6 or lower. While you may
get a stray answer to VB.NET (including VB2003 and VB2005 which has
dropped .NET from its name) questions here, you should ask them in
newsgroups devoted exclusively to .NET programming. Look for newsgroups
with either the word "dotnet" or "vsnet" in their name.
For the microsoft news server, try these newsgroups for Visual Basic
..NET related questions...
microsoft.public.dotnet.languages.vb
microsoft.public.dotnet.languages.vb.upgrade
microsoft.public.dotnet.languages.vb.controls
microsoft.public.dotnet.languages.vb.data
And these for more general .NET questions
microsoft.public.dotnet.general
microsoft.public.vsnet.general
Note: There are many other .NET newgroups (use the first three "fields"
from the last two as templates when searching for them), but the above
ones should get you started.
Rick