Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim sc As System.ServiceProcess.ServiceController
For Each sc In ServiceController1.GetServices
ListBox1.Items.Add(sc.ServiceName)
Next
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim sc As System.ServiceProcess.ServiceController
For Each sc In ServiceController1.GetServices
ListBox1.Items.Add(sc.DisplayName) 'Edit: shows pretty name for service
Next
ListBox1.SelectedIndex = ListBox1.FindString("Indexing") 'Change "Indexing" to "Apache2" or whatever the service name is
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim sc As System.ServiceProcess.ServiceController
For Each sc In ServiceController1.GetServices
If sc.DisplayName.StartsWith("In") Then
ListBox1.Items.Add(sc.DisplayName)
End If
Next
ListBox1.SelectedIndex = ListBox1.FindString("Indexing")
End Sub
listbox1.Items.Clear