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

ممكن حل لهذا الكود . 
كود :
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
       Dim arr As Array = VPN()
       If arr.GetValue(0) = True Then
           MsgBox(String.Format("
name: {0}
address: {1}
description: {2}", arr.GetValue(1), arr.GetValue(2), arr.GetValue(3)))

       Else
           MsgBox("لايوجد اتصال")
       End If
   End Sub

ما هو الحل 
هذه صورة الخطأ


وهذا الكود كامل 

كود :
Public Class Form1
   Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
       Dim arr As Array = VPN()
       If arr.GetValue(0) = True Then
           MsgBox(String.Format("
name: {0}
address: {1}
description: {2}", arr.GetValue(1), arr.GetValue(2), arr.GetValue(3)))

       Else
           MsgBox("لايوجد اتصال")
       End If
   End Sub
   Private Function VPN() As Array
       Dim nic As Net.NetworkInformation.NetworkInterface() = Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces
       If Not nic.Length < 0 And nic IsNot Nothing Then
           For Each netadapter As Net.NetworkInformation.NetworkInterface In nic
               'MsgBox(netadapter.Name)
               If netadapter.Name.ToLower.Trim.Contains("vpn") Then ' Or netadapter.Name.Equals("openVPN") ?
                   If netadapter.OperationalStatus = Net.NetworkInformation.OperationalStatus.Up Then
                       For Each addr In netadapter.GetIPProperties().UnicastAddresses
                           If addr.Address.AddressFamily = Net.Sockets.AddressFamily.InterNetwork Then
                               Return {True, netadapter.Name, addr.Address.ToString, netadapter.Description}
                           End If
                       Next
                   End If
               End If
           Next
       End If
       Return {False, Nothing, Nothing, Nothing}
   End Function
End Class
الرد }}}
تم الشكر بواسطة: asemshahen5
#2
السلام عليكم .. اضحى مبارك
تفضل اخي 
كود :
   Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
       Dim arr As Array = VPN()
       If arr.GetValue(0) = True Then
           MsgBox(String.Format("name: {0}address: {1}description: {2}", arr.GetValue(1), arr.GetValue(2), arr.GetValue(3)))

       Else
           MsgBox("لايوجد اتصال")
       End If
   End Sub

اعمل الخير وأجرك لا تنتظره فالله خير من إليك يرده
البرمجة ليست مجرد كود بل هي منهج تفكير منطقي لحل المشكلات







الرد }}}
تم الشكر بواسطة: الرائد , asemshahen5
#3
(12-08-19, 04:55 PM)ابراهيم ايبو كتب :
السلام عليكم .. اضحى مبارك
تفضل اخي 
كود :
   Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
       Dim arr As Array = VPN()
       If arr.GetValue(0) = True Then
           MsgBox(String.Format("name: {0}address: {1}description: {2}", arr.GetValue(1), arr.GetValue(2), arr.GetValue(3)))

       Else
           MsgBox("لايوجد اتصال")
       End If
   End Sub


فيجوال بيسك صراحة تختلف عن لغات البرمجة الاخرى 
فكما لاحظت انها لاتقبل الدوال الغير متممة في سطر جديد 
لكن مثلا في بايثون لا نعاني من هاته المشاكل فهو امر عادي
Angel  الحياة فترة اختبار , إما أن تكون او لاتكون  Rolleyes  
لن امل من البحث  ولن امل من السؤال
[b]رواد المعلوميات[/b]
الرد }}}
تم الشكر بواسطة: asemshahen5 , mac9


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  ممكن حل المشكلة فى الكود التالي - من مشاركة استاذنا القدير / عبدالله الدوسري new_programer 4 176 02-03-24, 07:36 PM
آخر رد: new_programer
  ماهو حل هذا الخطأ في الكود melad2002 7 275 25-02-24, 12:25 AM
آخر رد: justforit
  كيفية انشاء سكريبت لقاعدة بيانات من خلال الكود heem1986 1 213 20-02-24, 12:00 AM
آخر رد: Kamil
  [VB.NET] أرغب فى استخدام هذا الكود بالتحديد على الإصدار 10 AmeenRashed 3 210 19-01-24, 12:42 PM
آخر رد: Taha Okla
  شرح عن الخطأ attempted to read or write Adel27213 3 393 05-01-24, 01:01 AM
آخر رد: HALIM ELEULMA
  [VB.NET] ما الخطأ فى هذا الكود - كود البحث المتعدد Ashraf Elafify 7 476 27-12-23, 10:50 PM
آخر رد: Ashraf Elafify
  [VB.NET] اريد تعديل في الكود عند طباعة DGV abu_hisham7 1 439 03-12-23, 02:40 AM
آخر رد: abu_hisham7
  [VB.NET] أين الخطأ فى تشغيل هذا التطبيق AhmedEissa 0 242 27-10-23, 04:05 PM
آخر رد: AhmedEissa
  [كود] ما الخطأ فى الـ Functions المستخدم فى vb.net 2010 AhmedEissa 9 508 21-10-23, 11:44 PM
آخر رد: Ahmed5
  رجاء التعديل على الكود المرفق - كلاس لعرض كود المورد new_programer 4 361 13-10-23, 01:47 AM
آخر رد: new_programer

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


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