首页 > 编程 > .NET > 正文

获得网卡MAC地址和IP地址(VB.net)

2024-07-10 13:01:01
字体:
来源:转载
供稿:网友
private sub button1_click(byval sender 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")) then

textbox1.text += "ip(" & wmiobj("ipaddress")(0) & ")|mac(" & wmiobj("macaddress") & ")" & vbcrlf

end if

next

end sub

如果有人运行不出来的话==>首先,引用system.management;然后在代码中imports system.management;

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表