作業上有用到 作個筆記
//取得 網路名稱 例如:中華電信
private void dd()
{
NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adapter in interfaces)
{
comboBox2.Items.Add(adapter.Name.ToString());
}
}
//取得 網路介面卡名稱
private void GetAdtInfo()
{
string strQry = "Select * from Win32_NetworkAdapterConfiguration";
ManagementObjectSearcher objSc = new ManagementObjectSearcher(strQry);
ArrayList ar = new ArrayList();
foreach (ManagementObject objQry in objSc.Get())
{
comboBox1.Items.Add(objQry["Description"]);
}
}