17 Mayıs 2013 Cuma
İNTERNET BAĞLI MI, BAĞLANTIYI KES VEYA BAĞLAN KODU
Public Class Form1 'Kablolu Enable (0) 'Kablosuz Enable (1) ' kaynak http://social.msdn.microsoft.com/Forums/tr-TR/vbnettr/thread/a2723001-1d61-4e73-bda0-9f1f2f72327a Private Sub nEnable() Dim objWMIService = GetObject("winmgmts:\\.\root\cimv2") Dim colAdapters = objWMIService.Execquery("Select * from Win32_NetworkAdapter Where NetEnabled=false") colAdapters.ItemIndex(1).Enable() Label1.Text = "internete Bağlandı" End Sub Private Sub nDisable() Dim objWMIService = GetObject("winmgmts:\\.\root\cimv2") Dim colAdapters = objWMIService.Execquery("Select * from Win32_NetworkAdapter Where NetEnabled=true") colAdapters.ItemIndex(0).Disable() 'kablosuz Label1.Text = "internet Bağlantısı kesildi" End Sub Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click Button1.Enabled = True Button2.Enabled = False Call nDisable() End Sub Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Button1.Enabled = False Button2.Enabled = True Call nEnable() End Sub Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Try 'Google IP numaralarına ping at 'Dim internet = My.Computer.Network.Ping("208.67.222.222") 'If internet = True Then If My.Computer.Network.IsAvailable = True Then Label1.Text = "internet var" Button1.Enabled = False Button2.Enabled = True Else Label1.Text = "internet yok" Button2.Enabled = False Button1.Enabled = True End If Catch ex As Exception 'Button1.Enabled = True 'Label1.Text = "internet yok" & Chr(13) & "..." End Try End Sub End Class
Sonraki Kayıt
Önceki Kayıt
Ana Sayfa