Share via


Location property (Directions)

Returns the Location object that represents the best map view of the part of the route represented by the particular Directions collection, which may be the entire route or a portion of the route. Read-only.

Applies to

Collections: Directions

Syntax

object.Location

Parameters

Part

Description

object

Required. An expression that returns a Directions collection.

Example

  Sub ZoomToDirectionsLocation()

  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

  'Zoom to the best map view of the route
  Set objMap.Location = objRoute.Directions.Location

  End Sub

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