How to Change a Label's BackColor Property

  • Thread starter Thread starter OutdoorGuy
  • Start date Start date
O

OutdoorGuy

Greetings,

I have a very "novice" question to ask, so hopefully it will be easy.
At any rate, I have a label on a Windows form called "label1". I simply
want to change the "backcolor" property to a different color (e.g.,
"blue"), but I haven't figured out how to do it. I want to do this when
the user clicks a button. Any ideas?

Thanks in advance!
 
All you do is

label1.BackColor = Color.Aqua

Where label1 is the name of the label you want to change. Using Color
you could change it to any color you want.
 
On the form where these two controls are, double click the button that
you want to use to change the label's color. This will bring you to the
button's click event. In the braces for this routine, put the
following:

this.label1.BackColor = Color.Blue;

Once you build and run the app, clicking on the button thould set the
BackColor of the label blue.
 
Back
Top