Navigation property
Gets or sets the state of providing navigation. Read/write Boolean.
Applies to
Objects: GPSNavigation
Syntax
object.Navigation
Parameters
Part |
Description |
---|---|
object |
Required. An expression that returns a GPSNavigation object. |
Remarks
Changing this value is only available in Application or MappointControl objects not embedded as an OLE object. For example, a MappointControl object embedded within a Microsoft Office Word document will lack this functionality.
Setting this value to true may show a warning dialog box to the user, which the user must accept prior to the feature becoming enabled.
Note If the GPS device is tracking, enabling navigation will spawn a warning dialog box to the user.
C# Example
private void EnableNavigation()
{
const int E_GPS_USER_DECLINED = unchecked((int)0x80040FC8);
MapPoint.Map objMap = objApp.ActiveMap;
MapPoint.Route objRoute = objMap.ActiveRoute;
MapPoint.GPSNavigation objGPS = objMap.GPSNavigation;
try
{
objGPS.Tracking = true;
objGPS.Navigation = true;
}
catch (System.Runtime.InteropServices.COMException ex)
{
// if the user declines to navigate, silently fail
if (ex.ErrorCode != E_GPS_USER_DECLINED)
{
// if the GPS device is not installed or configured properly
// we'll fall into this block.
// notify the user of the problem.
MessageBox.Show(ex.Message);
}
}
}
Visual Basic Example
Private Sub EnableNavigation()
Const E_GPS_USER_DECLINED = &H80040FC8;
Dim objMap As MapPoint.Map = objApp.ActiveMap
Dim objRoute As MapPoint.Route = objMap.ActiveRoute
Dim objGPS As MapPoint.GPSNavigation = objMap.GPSNavigation
Try
objGPS.Tracking = True
objGPS.Navigation = True
Catch ex As System.Runtime.InteropServices.COMException
'if the user declines to navigate, silently fail
If ex.ErrorCode <> E_GPS_USER_DECLINED Then
'if the GPS device is not installed or configured properly
' we'll fall into this block.
' notify the user of the problem.
MessageBox.Show(ex.Message)
End If
End Try
End Sub