'要使得引用System.Management有效,先通過菜單
成都創(chuàng)新互聯(lián)公司專業(yè)為企業(yè)提供松溪網(wǎng)站建設(shè)、松溪做網(wǎng)站、松溪網(wǎng)站設(shè)計(jì)、松溪網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)與制作、松溪企業(yè)網(wǎng)站模板建站服務(wù),十多年松溪做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。
'[項(xiàng)目]--[添加引用],在“.Net”選項(xiàng)卡里,選擇“System.Management”,單擊[確定]
Imports System.Management
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MySearcher As New ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration")
For Each MySearcherObj As ManagementObject In MySearcher.Get
If CBool(MySearcherObj("IPEnabled")) Then
MsgBox(MySearcherObj("IPAddress")(0))
End If
Next
End Sub
End Class
出現(xiàn)這樣的原因,大部分是由于 無線網(wǎng)卡沒有安裝到位,接觸不良造成的。
網(wǎng)卡可以多插幾次。如果這樣,問題沒有解決,帶著您的筆記本找網(wǎng)卡服務(wù)商,如果他們解決不了,
那問題可能就在于筆記本本身。帶著您的本本和卡找您的本本服務(wù)商。
Private?Sub?GetMyIP()
Dim?strComputer?As?String
Dim?objWMI?As?Object
Dim?colIP?As?Object
Dim?IP?As?Object
Dim?I?As?Integer
strComputer?=?"."
objWMI?=?GetObject("winmgmts://"??strComputer??"/root/cimv2")
colIP?=?objWMI.ExecQuery?_
("Select?*?from?Win32_NetworkAdapterConfiguration?where?IPEnabled=TRUE")
For?Each?IP?In?colIP
If?Not?IsNothing(IP.IPAddress)?Then
For?I?=?LBound(IP.IPAddress)?To?UBound(IP.IPAddress)
MsgBox("IP?地址:"??IP.IPAddress(I)??Chr(10)??_
"網(wǎng)卡類型:"??IP.Description(I)??Chr(10)??_
"網(wǎng)卡地址:"??IP.Macaddress(I))
Next
End?If
Next
End?Sub
.net不能獲得【指定】網(wǎng)卡的信息,給個(gè)思路,先遍歷所有網(wǎng)卡,然后找到你需要的的那個(gè)網(wǎng)卡的信息。