Results 1 to 3 of 3

Thread: [RESOLVED] Get LAN Name (not Device Name)

  1. #1

    Thread Starter
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Resolved [RESOLVED] Get LAN Name (not Device Name)

    I can get the LAN Device Names (using code below) but how do you get those strings from the "Name" column (see image) that the user can change?

    Code:
    ' get list of enabled lan card device names
    Dim cat As New PerformanceCounterCategory("Network Interface")
    Dim instances As String() = cat.GetInstanceNames()
    For Each instance As String In instances
        Debug.WriteLine(instance)
    Next
    Attached Images Attached Images  

  2. #2
    Addicted Member
    Join Date
    Apr 2011
    Posts
    223

    Re: Get LAN Name (not Device Name)

    I do not fully understand the code myself but I found and tested this code and it did show what you are asking for. It is just a matter of selecting the one you want.
    Code:
    Imports System.Management
    Imports System.Runtime.InteropServices
    Imports System.Net.NetworkInformation
    
    
            
            Dim nics As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces()
            If nics Is Nothing OrElse nics.Length < 1 Then
                Debug.WriteLine("  No network interfaces found.")
                Exit Sub
            End If
            For Each adapter As NetworkInterface In nics
                Debug.WriteLine(adapter.Name)
            Next
    I found the code at:http://wiki.lessthandot.com/index.ph..._on_a_computer

  3. #3

    Thread Starter
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Get LAN Name (not Device Name)

    Quote Originally Posted by skor13 View Post
    I do not fully understand the code myself but I found and tested this code and it did show what you are asking for.
    NetworkInformation seems to do the trick, Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width