defining all the if's when first loading a form

Nucleus

Active member
Joined
May 24, 2005
Messages
30
Programming Experience
Beginner
So, I'm creating a form with a label, a picture box and two buttons. This form will control the Spooler service.
The label will say "Running" when the service is running and the picture box will be green. The "Start" button will be disabled and the "Stop" button will be enabled. The label will say "Stopped" when the service is stopped, the picture box will be red, the "Start" button will be enabled and the "Stop" button disabled.

My code below generates errors though.

If Spooler.Status.Equals(ServiceControllerStatus.Running) Then Label1.Text = "Running" And PictureBox1.BackColor = Color.Green And Button1.Enabled = False And Button2.Enabled = True
If Spooler.Status.Equals(ServiceControllerStatus.Stopped) Then Label1.Text = "Stopped" And PictureBox1.BackColor = Color.Red And Button1.Enabled = True And Button2.Enabled = False


I guess this would be a good time to say that I'm just trying things for the first time with VB.NET.

Any suggestions on how to set all the "if's" when the form is first loaded?
 
Back
Top