hello guys how r u all ?
my question is that, how can we get network interfaces in combo box and their mac addresses on selection changed event ...
Reply soon
Thanks.
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Nattudurai EswaramurthyRank #5,536 · 296 reputationPosted Jun 7, 2012, 1:52 AM EDT
UdpClient u = new UdpClient(remoteAddress, 1); IPAddress localAddr = ((IPEndPoint)u.Client.LocalEndPoint).Address;Now, if you want the NetworkInterface object you do something like:
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces()) { //Add it in Combo Box }Nattudurai EswaramurthyRank #5,536 · 296 reputationPosted Jun 7, 2012, 1:54 AM EDT
using System.Management; string query = "SELECT * FROM Win32_NetworkAdapterConfiguration"; ManagementObjectSearcher moSearch = new ManagementObjectSearcher(query); ManagementObjectCollection moCollection = moSearch.Get();// Every record in this collection is a network interface foreach (ManagementObject mo in moCollection) { // Do what you need to here.... } //u can do this as well.Faisal AnsariRank #3,366 · 427 reputationPosted Jun 7, 2012, 1:59 AM EDT
actually i have done like this,
var nic = NetworkInterfaces.GetAllNetworkInterfaces();
foreach( var ni in nic)
{
comboBox.Items.Add(ni.Name);
}
and now i have to get MAC address which is selected in combo box
like this
private void comboBox_SeletionChanged(object sender, SelectionChangedEventArgs e)
{
now what should i write here ???
}
VulpesRank #55 · 29.2K reputationPosted Jun 7, 2012, 6:44 AM EDT
{
textBox.Text = "";
return;
}