快速提问 - 我想简单地显示我的计算机所连接的网络名称。
例如,如果我已连接到无线网络'网络' - 如何在标签或消息框中简单地显示我已连接到此网络?
提前致谢 森
答案 0 :(得分:0)
首先,转到NuGet包管理器>管理NuGet包以获得解决方案。
点击Browse
并搜索managedwifi
安装包裹(应该只有一个)
一旦完成,按照我为你做的这个例子。
Imports System.Collections.ObjectModel
Imports System.Text
Imports NativeWifi
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
''THIS WILL DISPLAY THE CONNECTED WIFI'S NAME ON START UP.
Dim wlan = New WlanClient()
Dim connectedSsids As Collection(Of [String]) = New Collection(Of String)()
For Each wlanInterface As WlanClient.WlanInterface In wlan.Interfaces
Dim ssid As Wlan.Dot11Ssid = wlanInterface.CurrentConnection.wlanAssociationAttributes.dot11Ssid
connectedSsids.Add(New [String](Encoding.ASCII.GetChars(ssid.SSID, 0, CInt(ssid.SSIDLength))))
For Each item As String In connectedSsids
Label1.Text = item ''CHANGE THE LABEL TO A TEXTBOX OR WHERE EVER YOU WANT TO DISPLAY YOUR CONNECTED WIFI'S NAME.
Next
Next
End Sub
End Class
如果您有任何问题,请告诉我,我会尽快回复您。
快乐的编码!