Getting IPGlobalProperties with VB.net on a UWP application

你。 提交于 2019-12-02 13:22:11

Firstly, IPGlobalProperties class is not supported in uwp app. Since.NET for UWP apps provides a set of managed types that you can use to create Universal Windows Platform apps, but not the all. Details please reference .NET for UWP apps. System.Net namespace can be used in uwp app but IPGlobalProperties cannot.

Secondly you can find equivalent or similar APIs in uwp app. For example you can also find a NetworkInformation in uwp which is belong to Windows.Networking.Connectivity namespace. But invoking the methods of this class is not the same way with the System.Net.NetworkInformation namespace.

If you want to get the computer name or domain name as IPGlobalProperties did, you may invoke the GetHostNames() method. Code as follows:

Imports Windows.Networking.Connectivity
''' <summary>
''' An empty page that can be used on its own or navigated to within a Frame.
''' </summary>
Public NotInheritable Class MainPage
    Inherits Page

    Private Sub btngetinfo_Click(sender As Object, e As RoutedEventArgs)  
        Dim hostNames = NetworkInformation.GetHostNames()
        textDomain.Text = hostNames.First.ToString
    End Sub
End Class
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!