Share via


ElapsedDistance property

Returns the elapsed distance of the route as of the specified direction, in GeoUnits (miles or kilometers). Returns 0 if a route is not currently calculated. Read-only Double.

Applies to

Objects:  Direction

Syntax

object.ElapsedDistance

Parameters

Part Description
object Required. An expression that returns a Direction object.

Remarks

To calculate a route, use the Calculate method.

To return or set GeoUnits, use the Units property.

Example

    Sub FindDistanceToThirdDirection()

  Dim objApp As New MapPoint.Application   Dim objMap As MapPoint.Map   Dim objRoute As MapPoint.Route
  'Set up application   Set objMap = objApp.ActiveMap   Set objRoute = objMap.ActiveRoute   objApp.Visible = True   objApp.UserControl = True
  'Add route stops and calculate the route   objRoute.Waypoints.Add objMap.FindResults("Seattle, WA").Item(1)   objRoute.Waypoints.Add objMap.FindResults("Redmond, WA").Item(1)   objRoute.Calculate
  'Output the length of the route from the third direction   MsgBox "The distance from the start of the route to the third direction is: " _     + CStr(objRoute.Directions.Item(3).ElapsedDistance)
  End Sub

Note  This sample code is specific for use in MapPoint North America; it is for illustration purposes only.