要加入mengment的引用在.net框架中。

主要代码:

  ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
            ManagementObjectCollection nics = mc.GetInstances();
            foreach (ManagementObject nic in nics)
              {
                if (Convert.ToBoolean(nic["ipEnabled"]) == true)
                {
                    this.textBox1.Text = (nic["IPAddress"] as string[])[0];
                    this.textBox2.Text = (nic["IPSubnet"]   as  string[])[0];
                    this.textBox3.Text = (nic["DefaultIPGateway"] as string[])[0];
                  
                   }
                }

         

相关文章:

  • 2022-12-23
  • 2021-12-28
  • 2022-12-23
  • 2022-03-05
  • 2021-06-14
  • 2022-12-23
  • 2022-12-23
  • 2021-05-19
猜你喜欢
  • 2021-08-27
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
  • 2021-09-20
  • 2021-06-10
  • 2021-06-11
相关资源
相似解决方案