Share via


Cost property

Returns the total cost of a route. Returns 0 if a route is not currently calculated. Read-only Currency.

Applies to

Objects:  Route

Syntax

object.Cost

Parameters

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

Remarks

To return or set the method by which this cost is determined, use the DrivingCostUnits property of the DriverProfile object.

Example

    Sub FindRouteCost()

  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
  'Get the cost of the route   MsgBox "Cost of route: $" + CStr(objRoute.Cost)
  End Sub

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