Start/Stop Windows Services / indicator / progress bar
I need to create an application, that will have 2 buttons, to start and stop a windows service. If i make the first 2 work, more butons for more services will follow of course. There should also be a progress bar showing the service starting or stopping, and also an indicator showing if the process is started or stopped.
I have been working on Microsoft visual studio 2005 and VB .NET for the past 24 hours, and this code is what I've got so far.
Code:
Public Class ControlPanel
Private Sub ApacheStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnApacheStart.Click
ApacheProgressBar.Value = 0
ApacheTimer.Enabled = True
Shell("net start apache2")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnApacheStop.Click
ApacheProgressBar.Value = 0
ApacheTimer.Enabled = True
Shell("net stop apache2")
End Sub
Private Sub ProgressBar1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ApacheProgressBar.Click
ApacheTimer.Enabled = False
ApacheProgressBar.Value = 0
End Sub
Private Sub ApacheTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ApacheTimer.Tick
ApacheProgressBar.Value = ApacheProgressBar.Value + 1
If ApacheProgressBar.Value >= 10 Then _
ApacheTimer.Enabled = False
End Sub
End Class
The progress bar does not totally fill. It just fills up to a point and just stays there. Also, i have no idea how to add an indicator to show if the process is started or stopped. I have no previous programming experience.