Share via


SelectionChange event

Occurs when a selection on the map changes.

Applies to

Objects:  Map, MappointControl

Syntax

object.SelectionChange(NewSelection, OldSelection)

Parameters

Part Description
object An expression that evaluates to a Map or MappointControl object.
NewSelection ByVal Object. The newly selected Direction, Location, Pushpin, Shape, or Waypoint object on the map.
OldSelection ByVal Object. The previously selected object on the map.

Remarks

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

Do not create a modal dialog box—including message boxes—during this event.

Example

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

  Private Sub Command1_Click()     Dim objPin As MapPoint.Pushpin     'Add a Pushpin, then select it     Set objPin = objMap.AddPushpin(objMap.FindResults("Seattle, WA")(1))     objPin.Select   End Sub
  Private Sub Form_Load()     'Set up the application     Set objApp = CreateObject("mappoint.application")     Set objMap = objApp.ActiveMap     objApp.Visible = True     objApp.UserControl = True   End Sub
  Private Sub objMap_SelectionChange(ByVal NewSelection As Object, ByVal OldSelection As Object)     NewSelection.Location.GoTo   End Sub

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