Step1: Add a refrence(System.Management) in Refrences Folder
Step2: use these "name space system" in code windows
using System.Management;
using System.Runtime.Remoting;
using System.Security.Permissions;
using System.Net.NetworkInformation;
using System.Collections;
using System.ComponentModel;
Step3: make a private function as GetMacAddress() and call it on an event;
private string GetMacAddressNew()
{
string macAddresses = "";
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
{
if (nic.OperationalStatus == OperationalStatus.Up)
{
macAddresses += nic.GetPhysicalAddress().ToString();
break;
}
}
return macAddresses;
}
That's it all.
Step2: use these "name space system" in code windows
using System.Management;
using System.Runtime.Remoting;
using System.Security.Permissions;
using System.Net.NetworkInformation;
using System.Collections;
using System.ComponentModel;
Step3: make a private function as GetMacAddress() and call it on an event;
private string GetMacAddressNew()
{
string macAddresses = "";
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
{
if (nic.OperationalStatus == OperationalStatus.Up)
{
macAddresses += nic.GetPhysicalAddress().ToString();
break;
}
}
return macAddresses;
}
That's it all.