I am writing a very simple Universal Windows application with VB in Visual Studio 2017. The application should gave basic network information to the user, so I wanted to collect
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
'''
''' An empty page that can be used on its own or navigated to within a Frame.
'''
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