1 Attachment(s)
[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
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
Re: Get LAN Name (not Device Name)
Quote:
Originally Posted by
skor13
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!