Disconnet Shell("cmd.exe /c ipconfig/release")
connet
Shell("cmd.exe /c ipconfig/renew")
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Shell("cmd.exe /c ipconfig/release")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Shell("cmd.exe /c ipconfig/renew")
End Sub
Private Function IsconnectionAvailable() As Boolean
Dim objUrl As New System.Uri("http://www.google.com")
Dim objwebReq As System.Net.WebRequest
objwebReq = System.Net.WebRequest.Create(objUrl)
Dim objResp As System.Net.WebResponse
Try
objResp = objwebReq.GetResponse
objResp.Close()
objwebReq = Nothing
Return True
Catch ex As Exception
objResp = Nothing
objwebReq = Nothing
Return False
End Try
End Function
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If IsconnectionAvailable() = True Then
Label2.Text = "Yes"
ElseIf IsconnectionAvailable() = False Then
Label2.Text = "No"
End If
End Sub
End Class