09-02-16, 12:19 AM
اخواني السلام عليكم اريد كود للفيجوال بيزك 10 او 12 يجعل البرنامج لا يشتغل الا بوجود الانترنت
اي عندما لا تكن الانترنت موجودة لا يشتغل ويطلع رسالة خطأ
وشكرا
اخواني السلام عليكم Public Function HaveInternetConnection() As Boolean
Try
Return My.Computer.Network.Ping("www.google.com")
Catch
Return False
End Try
End Function Public Shared Function CheckInternetConnection() As Boolean
Try
Return My.Computer.Network.Ping("www.google.com")
Return True
Catch
Return False
End Try
End Function
If CheckInternetConnection() = True Then
MessageBox.Show("Your Computer is Connected to internet", "Connected", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
MessageBox.Show("Your Computer is not Connected to internet", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Application.Exit()
End If
(28-04-16, 10:10 PM)mostfa1995 كتب : [ -> ](28-04-16, 10:03 PM)amgad525 كتب : [ -> ]http://vb4arb.com/vb/thread-14676-post-7...l#pid70192
PHP كود :
If CheckInternetConnection() = True Then
MessageBox.Show("Your Computer is Connected to internet", "Connected", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
MessageBox.Show("Your Computer is not Connected to internet", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Application.Exit()
End If
PHP كود :
Public Shared Function CheckInternetConnection() As Boolean
Try
Return My.Computer.Network.Ping("www.google.com")
Return True
Catch
Return False
End Try
End Function
شغال تمام اشكرك على المجهود الرائع
If My.Computer.Network.IsAvailable Then
Label1.ForeColor = Color.Green
Label1.Text = "حالة الإتصال : متصل"
Else
Label1.ForeColor = Color.Red
Label1.Text = "حالة الإتصال : غير متصل"
End If(09-02-16, 02:23 AM)boudyonline كتب : [ -> ]اخي الفاضل :
يمكنك التحقق من وجود الاتصال بالانترنت من خلال تجربة الاتصال على موقع ما وليكن جوجل
ويمكنك استخدام الكود التالي :
كود :
Public Function HaveInternetConnection() As Boolean
Try
Return My.Computer.Network.Ping("www.google.com")
Catch
Return False
End Try
End Function