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.

GeoCoordinateWatcher.Position Property

.NET Framework (current version)
 

Gets the GeoCoordinate which indicates the current location.

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

Public ReadOnly Property Position As GeoPosition(Of GeoCoordinate)

Property Value

Type: System.Device.Location.GeoPosition(Of GeoCoordinate)

The GeoCoordinate which indicates the current location.

In the following example, the Location property of the Position property is saved in a GeoCoordinate object. The latitude and longitude fields of the GeoCoordinate are printed if they are known.

Public Sub GetLocationProperty()
    Dim watcher As New System.Device.Location.GeoCoordinateWatcher()
    watcher.TryStart(False, TimeSpan.FromMilliseconds(1000))

    Dim coord As GeoCoordinate = watcher.Position.Location

    If coord.IsUnknown <> True Then
        Console.WriteLine("Lat: {0}, Long: {1}", coord.Latitude, coord.Longitude)
    Else
        Console.WriteLine("Unknown latitude and longitude.")
    End If
End Sub

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