تقييم الموضوع :
  • 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


الردود في هذا الموضوع
هذا الخطأ في هذا الكود - بواسطة mac9 - 12-08-19, 03:58 PM


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


يقوم بقرائة الموضوع: