Simple Change Label ForeColor

P

Phillip Vong

Newbie learning in VB.NET

Stupid question.

I have Label1.Text = "Hello World"

How do I change the Forecolor in code? I know how to set it using VS but I
want to change the Forecolor depening on certain scenerios.

Thanks!
 
N

Nathan Sokalski

You would simply use the ForeColor property. If you want to set it depending
on different conditions, use an if statement like the following:

If Label1.Text <> "" Then Label1.ForeColor = Color.Black

Hopefully this is enough to get you started on what you needed. Good Luck!
 
P

Phillip Vong

That's perfect. Thanks!


Nathan Sokalski said:
You would simply use the ForeColor property. If you want to set it
depending on different conditions, use an if statement like the following:

If Label1.Text <> "" Then Label1.ForeColor = Color.Black

Hopefully this is enough to get you started on what you needed. Good Luck!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,158
Latest member
Vinay_Kumar Nevatia
Top