View Full Version : Clear/Remove all Pushpins in Mappoint?

10-04-2005, 09:22 AM
Is there a way to remove all pushpins? How would you do it?
I have tried 'objPin.delete()', where objPin is 'Mappoint.Pushpin', but it only deletes the last Pushpin created. I need something such as 'objPin.deleteAllPushpin().

I am writing an application using Mappoint. I have only a week to write and test the program.

To give you a complete understanding, here is my semi pseudocode:

- Load Map
- Start Timer with 5 seconds interval (run code below every 5 seconds)
- [b]Clear all 'Pushpins' and 'BalloonStates'[/b]
- Check SQL database for entries in the previous 5 Seconds
- If entry found,
- For each record,
- Place 'Pushpin' on location
- Display 'BalloonState' for pushpin
- Else (No records were found for the last 5 seconds)
- Retrieve the 1st record
- Place 'Pushpin' on location
- Display 'highlight' for Pushpin
- Display 'Balloonstate' for Pushpin

Can you please point me to the right direction?

John Meyer
10-05-2005, 12:15 PM
The best way to delete all pushpins is to delete the dataset. You can loop thru the datasets to "get" the one you want to delete. You do not want to loop thru the pushpins and delete them one by one if you have alot of pins it could take a while. Hope this code snippit helps.

Dim objmap As MapPointCtl.Map
Set objmap = MappointControl1.ActiveMap
Dim objDataSet As MapPoint.DataSet

For Each objDataSet In objmap.DataSets
If objDataSet.Name = "My Pushpins" Then
MsgBox "Deleted Dataset"
Exit For
End If

10-05-2005, 03:45 PM

Thanks for the reply. I will try it and let you know if it solves my problem or not.

Thanks again.


10-10-2005, 01:47 PM

As I have promised, here I am ...

The solution you have provided me clears the pushpins and balloonstates If I open a Data Map that is created using mappoint 2004. However, If the dataset is created using programmatically imported data ('MapPoint.Map.DataSets.ImportData()' ), it does not delete it.

The second problem with my application is that it is too slow to process in less than 1 second time interval.

Does anybody know a better way of doing this:

Data Sources:
1) Access Database - > is updated frequently (in seconds)
Data it holds: Store, Salesman, Time, Item, Price

2) Excel spread Sheet - >
Data It holds: Store Name, address (location) of stores


1) Clear all pushpin and BalloonState
2) Display pushpins for all locations in the Excel file
3) Retrieve data inserted in Access database for the last 5 seconds (SELECT * FROM xtable Where Time > DateTime.Now.Second - 5 )
4) When Store Name from Access Database is equal to Store Name from Excel File, display pushpin and balloon for those particular addresses
5) Repeat step 1, 2, 3, 4 & 5 ( Timer control with 1 min interval)

The bold steps are what I am having trouble with
I would really appreciate any help!


10-12-2005, 01:29 PM

As far as I understeand you, you have no problem do the bold things, but you have a problem with the speed as several times a second there is update. Is this correct ?

How manu pushpins you have to delete / display, and in which interval ?