Share via


Clear method

Clears a route from the map, removing all waypoints (start point, stops, and end point); similar to clicking Clear Route on the Route menu.

Applies to

Objects: Route

Syntax

object.Clear

Parameters

Part

Description

object

Required. An expression that returns a Route object.

Example

Sub ClearCalculatedRoute()

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

'Now clear the route
objRoute.Clear

End Sub

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