Dim ipConfig As Process
Dim oneLine As String
Dim lineParts() As String
ipConfig = New Process()
ipConfig.StartInfo.FileName = "ipConfig.exe"
ipConfig.StartInfo.Arguments = "/renew"
ipConfig.StartInfo.UseShellExecute = False
ipConfig.StartInfo.RedirectStandardOutput = True
ipConfig.StartInfo.CreateNoWindow = True
ipConfig.Start()
Do While Not ipConfig.StandardOutput.EndOfStream
oneLine = ipConfig.StandardOutput.ReadLine()
If (Trim(oneLine) = "") Then Continue Do
If (oneLine = oneLine.TrimStart) Or (InStr(oneLine, ":") = 0) Then
LogMessage1(oneLine.Trim)
Else
lineParts = (oneLine.Trim.Split(":"c))
lineParts(0) = Replace(lineParts(0), ". ", "")
lineParts(1) = lineParts(1).Trim
LogMessage1(vbTab & lineParts(0) & ":" & lineParts(1))
End If
Loop
ipConfig.WaitForExit()
ipConfig.Dispose()
Dim myWorkstation As String = System.Net.Dns.GetHostName()
Dim IPAddress As String = System.Net.Dns.GetHostEntry(myWorkstation).AddressList(0).ToString()
Me.Label36.Text = IPAddress
'--- Network Connectivity ----
Dim Net As String = My.Computer.Network.IsAvailable
If Net = True Then
Me.Label38.Font = New Font("Arial", 8, FontStyle.Bold)
Me.Label38.Text = ("Yes")
Else
Me.Label38.Font = New Font("Arial", 8, FontStyle.Bold)
Me.Label38.Text = ("No")
End If
'--- Internet Connectivity ----
Try
If Net = True Then
Dim Int As String = My.Computer.Network.Ping("www.usa.gov")
If Int = True Then
Me.Label39.Font = New Font("Arial", 8, FontStyle.Bold)
Me.Label39.Text = ("Yes")
Else
Me.Label39.Font = New Font("Arial", 8, FontStyle.Bold)
Me.Label39.Text = ("No")
End If
Else
Me.Label39.Font = New Font("Arial", 8, FontStyle.Bold)
Me.Label39.Text = ("No")
End If
Catch ex As Exception
Me.Label39.Font = New Font("Arial", 8, FontStyle.Bold)
Me.Label39.Text = ("No")
End Try