检查ServiceControllerStatus是否为NULL vb.net

时间:2022-09-13 14:00:26

how would I check if ServiceControllerStatus is NULL/value does not exist with the code I have as follows:

我如何检查ServiceControllerStatus是否为NULL /值与我的代码不存在,如下所示:

Dim controller As New ServiceController("value")
            If controller.Status = ServiceControllerStatus.Running Then
                ListBox1.Items.Add("Value Service running")
            Else
                Label2.Text = ""
            End If

Is there an "empty or NULL" function I could use?

我可以使用“空或NULL”功能吗?

Thanks

谢谢

1 个解决方案

#1


1  

Do you mean:

你的意思是:

If controller.Status = Nothing Then

?

#1


1  

Do you mean:

你的意思是:

If controller.Status = Nothing Then

?