-
Pushpins
Hi guys,
I am trying to integrate mappoint with our application, I was able to locate the addresses that we want on mappoint However when i select those pushpins that i have added it seems like i can only find the one that i clicked on. Here is my code
If TypeOf g_oApp.ActiveMap.Selection Is Pushpin Then
msgbox g_oApp.ActiveMap.Selection.Name
End If
what i want to know is, if there is a collection which holds all the selected pushpins.
Thank you
-
Yes, the collection is a Dataset. This sample my help, here I'm using a Mappoint ActiveX Control named MPC. (By Default it would be named MappointControl1.)
Dim objDataSet As MapPointCtl.DataSet
Dim objmap As MapPointCtl.Map
Dim objRecordset As MapPointCtl.Recordset
Set objmap = MPC.ActiveMap
For Each objDataSet In objmap.DataSets
If InStr(objDataSet.Name, "My Pushpins") Then
Set objRecordset = objDataSet.QueryAllRecords
'objDataSet.ZoomTo
Do Until objRecordset.EOF
objRecordset.Pushpin.Symbol = 20
objRecordset.MoveNext
Loop
End If
Next
-
John,
Your solution gives me all the pushpins in the dataset, but what i want is the once which are selected or highlighted.
-
This will only change the pushpin if it is highlighted.
Dim objDataSet As MapPointCtl.DataSet
Dim objmap As MapPointCtl.Map
Dim objRecordset As MapPointCtl.Recordset
Set objmap = MPC.ActiveMap
For Each objDataSet In objmap.DataSets
If InStr(objDataSet.Name, "My Pushpins") Then
Set objRecordset = objDataSet.QueryAllRecords
'objDataSet.ZoomTo
Do Until objRecordset.EOF
If objRecordset.Pushpin.Highlight = True Then
objRecordset.Pushpin.Symbol = 20
End if
objRecordset.MoveNext
Loop
End If
Next