Clear previous itinerary

Anonymous
11-03-2004, 08:25 AM
Hi,

After Calculating an itinerary, how to clear it from the map?

Do I close the map and open it again, or there is a method like

CloseAllItinerary


Thanks in advance for any help

Aurelia
[/quote][/code]

John Meyer
11-03-2004, 08:37 AM
This is a sample from the help file.

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

Anonymous
11-03-2004, 09:09 AM
Hi,

Thanks John for your answer.

What I need is not to clear an itinerary just after calculating.
I want to let an itineary on the map and to clear it only if I calculate a new
one or by clicking a button or getting the old itinerary with a method like objRoute.Selection .

The idea I have now is save my addresses in some global variables. But I have to calculate my old itinerary again defore clearing it.

Any other ideas?

Regards
Aurelia

John Meyer
11-03-2004, 09:23 AM
No problem, just get a hook to the ActiveRoute and use the clear method.

Set objRoute = objMap.ActiveRoute
objRoute.Clear

Anonymous
11-03-2004, 09:36 AM
Thanks John, It was so easy !

Aurelia

 
Web mp2kmag.com
mapforums.com