private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
ManagementObjectSearcher search = new ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapter");
if (e.Node.Text == "NVIDIA nForce 10/100 Mbps Ethernet")
foreach (ManagementObject info in search.Get())
{
try
{
//textBox1.Text=info["NetworkAddresses[]"].ToString();
//textBox1.Text = info["IPAddress[ ]"].ToString();
if (info["MACAddress"].ToString() == "00:1E:68:12:36:AF")
textBox2.Text = info["MACAddress"].ToString();
textBox3.Text = info["MaxSpeed"].ToString();
textBox4.Text = info["AdapterType"].ToString();
textBox5.Text = info["NetConnectionStatus"].ToString();
textBox6.Text = info["Manufacturer"].ToString();
textBox7.Text = info["GUID"].ToString();
}
catch (Exception)
{ }
}
if (e.Node.Text == "Atheros AR5007 802.11b/g WiFi Adapter")
{
foreach (ManagementObject info in search.Get())
{
try
{
// if (info["Name"].ToString() == "Atheros AR5007 802.11b/g WiFi Adapter" || info["Name"].ToString() == "NVIDIA nForce 10/100 Mbps Ethernet")
//textBox1.Text=info["NetworkAddresses[]"].ToString();
//textBox1.Text = info["IPAddress[ ]"].ToString();
if (info["MACAddress"].ToString() == "00:1F:3A:33:7E:D4")
textBox2.Text = info["MACAddress"].ToString();
textBox3.Text = info["MaxSpeed"].ToString();
textBox4.Text = info["AdapterType"].ToString();
textBox5.Text = info["NetConnectionStatus"].ToString();
textBox6.Text = info["Manufacturer"].ToString();
textBox7.Text = info["GUID"].ToString();
}
catch (Exception)
{ }
}
}
Mod Edit: When you are posting code please use code tags like this.

New Topic/Question
This topic is locked




MultiQuote






|