Kod:
Private Function netcheck() As Boolean Dim req As System.Net.WebRequest = System.Net.WebRequest.Create("http://google.com.tr/") Dim resp As System.Net.WebResponse Try resp = req.GetResponse() resp.Close() req = Nothing Return True Catch ex As Exception req = Nothing Return False End Try End Function
Ornek Kullanım:
Kod:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try netcheck() Catch ex As Exception MsgBox("Hata Kodu (1)" & vbNewLine & "İnternet bağlantınız yok, lutfen daha sonra tekrar deneyin.", MsgBoxStyle.Critical, "Ornek Program") Me.Close() End Try End Sub
__________________
[VB.NET] İnternet Bağlantısını Kontrol Etme
Programlama0 Mesaj
●23 Görüntüleme
- ReadBull.net
- Programlama ve Yazılım
- Programlama
- [VB.NET] İnternet Bağlantısını Kontrol Etme