marceltje
marceltje

Reputation: 127

How to show network adapter name instead of full device name

Im making an application which does something with netsh. However, the Wireless network adapter should be selected by the user via a combo box. Unfortunately, it shows the entire device name( eg. "Realtek RTL8188CU Wireless LAN adapter") instead of Wi-Fi, as seen under network centre > networkadapters. I'm trying to make it read the Wi-Fi part, which in some languages is diffrent if i recall correctly, and the name must be correct for my program to work.

foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
        {
            if ((nic.NetworkInterfaceType == NetworkInterfaceType.Wireless80211) && (nic.OperationalStatus == OperationalStatus.Up))
            {
                comboBox1.Items.Add(nic.Description);
            }
        }

this is what i want to read, to be clear. I already ensure any virtual connections or wired connections do not show. https://puu.sh/w1LFb/6c19a16ebc.png

Upvotes: 1

Views: 1212

Answers (1)

mjw
mjw

Reputation: 1206

    foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
    {
        if ((nic.NetworkInterfaceType == NetworkInterfaceType.Wireless80211) && (nic.OperationalStatus == OperationalStatus.Up))
        {
            comboBox1.Items.Add(nic.Name);
        }
    }

Upvotes: 2

Related Questions