Get MAC address of your system
This sample code shows how to retrieve the MAC address of your computer using C#. Can convert this code to VB.NET easily. Code for Get MAC address of your system.
Learn Get MAC address of your system
This sample code shows how to retrieve the MAC address of your computer using C#. Can convert this code to VB.NET easily.
public string GetMACAddress()
{
ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection moc = mc.GetInstances();
string MACAddress = String.Empty;
foreach (ManagementObject mo in moc)
{
if (MACAddress == String.Empty) // only return MAC Address from first card
{
if ((bool)mo["IPEnabled"] == true) MACAddress = mo["MacAddress"].ToString();
}
mo.Dispose();
}
MACAddress = MACAddress.Replace(":", "");
return MACAddress;
}

gud info thanks for sharing