Share via


DrivingTime property

Returns the total driving time for a route. Elapsed time is in fractional days. For example, one hour equals 1/24 (or .041666). Returns 0 if a route is not currently calculated. Read-only Double.

Applies to

Objects:  Route

Syntax

object.DrivingTime

Parameters

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

Remarks

You can use GeoTimeConstants values when setting the DrivingTime property.

Total driving time does not include time elapsed during rest stops, at waypoints, or during ferry travel.

Example

    Sub GetRouteDrivingTime()

  Dim objApp As New MapPoint.Application   Dim objMap As MapPoint.Map   Dim objRoute As MapPoint.Route
  'Set up the 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
  'Find the driving time of the route   MsgBox "Driving time in minutes: " + CStr(objRoute.DrivingTime / geoOneMinute)
  End Sub

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