uint32 conversion on win32_pingstatus

J

James

Dim str As String = "select * from win32_pingstatus where address=
'192.168.0.1'"
Dim search1 As New ManagementObjectSearcher(str)
Dim result As ManagementObject

Try
For Each result In search1.Get
If result("statuscode") = 0 Then
Console.WriteLine("computer response")
Else
Console.WriteLine("invalid computer")
End If
Next
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try


i keep on getting exception error : Cast from type 'UInt32' to type
'Integer' is not valid. Pls advise
 
K

Ken Tucker [MVP]

Hi,

Try this.

Dim intResult As Integer = Integer.Parse(result("statuscode").ToString)

If intResult = 0 Then



Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top