تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.NET] مساعدة التحقق من الاتصال بالانترنت
#1
اهلا بكم

يسعد الله اوقاتكم جميعا

عندي استفسار بخصوص كود التحقق من الانترنت

انا الكود اللي عندي هذا

كود :
                          If Computer.Network.IsAvailable Then

                                       Try
                                           If Computer.Network.Ping("www.Google.com") Then


MsgBox("Computer is connected")



                                           Else

                                               'MsgBox("Computer is not connected to the internet !!!")
                                           End If
                                       Catch

                                       End Try

                                   Else
                                       'MsgBox("Computer is not connected to the internet !!!")
                                   End If


هو شغال تمام

المشكله التي اواجهها

اني اقوم بالبحث في ملف xml   موجود في احد المواقع

وفي حالت ضعف الانترنت يعلق البرنامج حتى يقوم بسحب المعلومات

وهذا الكود
كود :
     Dim url As String = String.Format("https://www.hamqth.com/xml.php?id={0}&callsign={1} &prg=BKLOG", Label17.Text, calls.Text)


                       Dim document As XmlReader = New XmlTextReader(url)

                       'loop through the xml file
                       While (document.Read())

                           Dim type = document.NodeType

                           'if node type was element
                           If (type = XmlNodeType.Element) Then

                               'if the loop found a <FirstName> tag
                               If (document.Name = "adr_name") Then

                                   Lfullname.Text = document.ReadInnerXml

                               End If
                               If (document.Name = "us_state") Then

                                   state.Text = document.ReadInnerXml

                               End If
                               'if the loop found a <FirstName> tag
                               If (document.Name = "qth") Then

                                   qth.Text = document.ReadInnerXml

                               End If


                               'if the loop found a <FirstName> tag
                               If (document.Name = "grid") Then

                                   WORKinfo.GRIDSQUARE.Text = document.ReadInnerXml

                               End If

                               'if the loop found a <FirstName> tag
                               If (document.Name = "qsl_via") Then

                                   WORKinfo.Lqslmgr.Text = document.ReadInnerXml

                               End If

                               'if the loop found a <FirstName> tag
                               If (document.Name = "latitude") Then

                                   WORKinfo.LAT.Text = document.ReadInnerXml

                               End If

                               'if the loop found a <FirstName> tag
                               If (document.Name = "longitude") Then

                                   WORKinfo.LON.Text = document.ReadInnerXml

                               End If

                           End If

                       End While
                   End If



الان السؤال هل في طريقة في حالت ضغف النت ما يقوم بسحب الداتا 


بارك الله فيكم وشكرا
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
مساعدة التحقق من الاتصال بالانترنت - بواسطة dubai.eig - 18-05-17, 01:37 PM


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم