Error 3 'Catch' cannot catch type 'Object' because it is not 'System.Exception' or a class that inherits from 'System.Exception'. D:\frm.vb 66 35
Private Sub TmbEndService_Click(ByVal sender As Object, ByVal e As EventArgs) Dim flag As Boolean = False Dim item As ListViewItem For Each item In Me.ListViewServices.CheckedItems Application.DoEvents Try Dim services As ServiceController() = ServiceController.GetServices Dim i As Integer For i = 0 To services.Length - 1 Try Do While (item.Text = services(i).ServiceName.Trim) Application.DoEvents If (services(i).Status.ToString = "Stopped") Then MessageBox.Show("The service(s) status stopped", "Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) Me.TmbRefResh_Click(sender, e) Application.DoEvents ElseIf services(i).CanStop Then services(i).Stop Thread.Sleep(&H3E8) item.Remove Application.DoEvents Else MessageBox.Show("The service(s) can't be stop", "Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) End If Loop Catch obj1 As Object End Try services(i).Refresh Next i flag = True Catch obj2 As Object End Try Next If Not flag Then MessageBox.Show("Please select service(s) do you want to end", "Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) Me.Refresh End If End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)