visual basic: Public member 'ForeColor' on type 'String' not found

  • Thread starter Thread starter Jurgen Oerlemans
  • Start date Start date
J

Jurgen Oerlemans

Hello, I want to change to forecolor of a label. The label is named
"lblDevice1"
I create a variable called Var

Dim Var
Var = "lblDevice1"

So the next step is:
Var.ForeColor = System.Drawing.Color.Green

--> Public member 'ForeColor' on type 'String' not found

How do I declare my variable the right way?

Best regards, Jurgen
 
Jurgen Oerlemans said:
Hello, I want to change to forecolor of a label. The label is named
"lblDevice1"
I create a variable called Var

Dim Var
Var = "lblDevice1"

So the next step is:
Var.ForeColor = System.Drawing.Color.Green

--> Public member 'ForeColor' on type 'String' not found

How do I declare my variable the right way?

Best regards, Jurgen
Why do you want to create a variable? Or, am I missing something?
You can change the foreground color directly:

lblDevice1.ForeColor = Color.(select from provided list)
 
I know I can change it directly,

But I do the same thing like 20 times. And not only for ForeColor, but also
on 2 other properties.
So I don't want to write 60 lines when it can be done in just a few

Jurgen
 
Back
Top