Share via


Selection property

Returns the DataSet, Direction, Location, Pushpin, Shape, or Waypoint object selected on the map. If nothing is selected on the map, or if the selection is not one of these objects, then "Nothing" is returned. Read-only.

Applies to

Objects: Map

Syntax

object.Selection

Parameters

Part

Description

object

Required. An expression that returns a Map object.

Remarks

  • If the selected object is a waypoint that is in a route multiple times, the Selection property returns the waypoint that appears selected in the Route Planner pane. If the Route Planner pane is not showing, it returns the last occurrence of that waypoint in the route.

Example

Sub SelectPushpin()
 
  Dim objApp As New MapPoint.Application
  Dim objMap As MapPoint.Map
  Dim objPin As MapPoint.Pushpin
 
  'Set up the application
  Set objMap = objApp.ActiveMap
  objApp.Visible = True
  objApp.UserControl = True
 
  'Add a Pushpin and select it. Was it selected correctly?
  Set objPin = objMap.AddPushpin(objMap.FindResults("Seattle, WA")(1))
  objPin.Select
  If TypeOf objMap.Selection Is Pushpin Then
    MsgBox "Pushpin was correctly selected."
  Else
    MsgBox "Pushpin was not correctly selected."
  End If
 
  End Sub
 

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