Share via


RouteAfterCalculate event

Occurs after the route has been calculated.

Applies to

Objects: Map, MappointControl

Syntax

object.RouteAfterCalculate(Rte)

Part

Description

object

An expression that evaluates to a Map or MappointControl object.

Rte

Route object. The route for which properties were changed. Is always the same as the ActiveRoute property of the Map object. (For the MappointControl object, the ActiveRoute property can be accessed through the ActiveMap property.)

Remarks

  • A route is calculated by using the Calculate method on the Route object, or by clicking Get Directions on the Route menu in the user interface.

  • Do not make this event infinitely recursive by calling itself or causing itself to be called.

Example

  Dim WithEvents objApp As MapPoint.Application
  Dim WithEvents objMap As MapPoint.Map
  Dim objRoute As MapPoint.Route

  Private Sub Command1_Click()
    'Create a route and calculate it
    objRoute.Waypoints.Add objMap.FindResults("Seattle, WA").Item(1)
    objRoute.Waypoints.Add objMap.FindResults("Spokane, WA").Item(1)
    objRoute.Calculate
  End Sub

  Private Sub Form_Load()
    'Set up the application
    Set objApp = CreateObject("mappoint.application")
    Set objMap = objApp.ActiveMap
    Set objRoute = objMap.ActiveRoute
    objApp.Visible = True
    objApp.UserControl = True
  End Sub

  Private Sub objMap_RouteAfterCalculate(ByVal Rte As MapPoint.Route)
    MsgBox "The route has been calculated."
  End Sub

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