PDA

View Full Version : SelectionChange event will not fire from ActiveX



LeeBates
03-02-2012, 02:18 PM
I have VB. 2008 windows form applications that have MapPoint ActiveX controls. MapPoint 2011 is currently installed. I am trying to identify when my user clicks on a pushpin. Niwther the Before Double-click nor SelectionChange events are going to my event handlers. I have seen two descriptions of handler specifications and have tried both to no avail.
1. What exactly causes the SelectionChange method to fire (I assume a mouse click on a pushpin)
2. Am I missing a setting on my form or on the control?
3. ActiveX is specified as Friend, withevents.

Private Sub AxMap_SelectionChange(ByVal sender As Object, ByVal e As AxMapPoint._IMappointCtrlEvents_SelectionChangeEve nt) Handles AxMap.SelectionChange
'If pushpin selected, pop up prospect box
Try
If TypeOf e.pNewSelection Is MapPoint.Pushpin Then
selectedPushPin = e.pNewSelection
Call PopUpProspect()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

and....

Private Sub AxMap_SelectionChange(ByVal NewSelection As Object, ByVal OldSelection As Object) Handles AxMap.SelectionChange
Try
If TypeOf NewSelection Is MapPoint.Pushpin Then
selectedPushPin = NewSelection
Call PopUpProspect()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub