Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

GeoCoordinate.Unknown Field

.NET Framework (current version)
 

Represents a GeoCoordinate object that has unknown latitude and longitude fields.

Namespace:   System.Device.Location
Assembly:  System.Device (in System.Device.dll)

Public Shared ReadOnly Unknown As GeoCoordinate

The IsUnknown property can be used to verify whether a GeoCoordinate contains no data.

The following code example verifies whether the GeoCoordinate that corresponds to a location is Unknown before printingout its latitude and longitude.

Imports System.Device.Location
Module GetLocationProperty
    Public Sub GetLocationPropertyHandleUnknown()
        Dim watcher As New System.Device.Location.GeoCoordinateWatcher()
        watcher.TryStart(False, TimeSpan.FromMilliseconds(1000))
        If watcher.Position.Location.IsUnknown <> True Then
            Dim coord As GeoCoordinate = watcher.Position.Location
            Console.WriteLine("Lat: {0}, Long: {1}", coord.Latitude, coord.Longitude)
        Else
            Console.WriteLine("Unknown latitude and longitude.")
        End If
    End Sub

    Public Sub Main()
        GetLocationPropertyHandleUnknown()
        Console.ReadLine()
    End Sub

End Module

.NET Framework
Available since 4.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show:
© 2017 Microsoft