Get a network card MAC address and IP address (VB.NET)

xiaoxiao2021-03-06  84

Private sub button1_click (byvale as system.object, byval e as system.eventargs) Handles Button1.click

DIM WMI As New System.Management.ManagementObjectSearcher ("Select * from win32_networkadapterconfiguration")

TextBox1.text = ""

For Each Wmiobj As ManagementObject in WMI.GET

IF CBOOL (WMIOBJ ("iPenabled")).

TextBox1.text = "IP (" & WMIOBJ ("iPaddress") (0) & ") | Mac (" & WMIOBJ ("MacAddress") & ") & vbrlf

END IF

NEXT

End Sub If someone can't run, ==> First, reference system.Management; then in the code in the code;

转载请注明原文地址:https://www.9cbs.com/read-95027.html

New Post(0)