Josemi
04-11-2003, 10:16 AM
Hi.
I'm using a MapPoint control inserted in a VB 6 form. Is there a way to
remove all pushpins in the map without "FindPushpin" all of them? Sometimes,
I want to clear the map, I know there must be some pushpins, but I don't
know their names. So I would need something like "map.RemoveAllPushpins()".
Thanks in advance.
Eric Frost
04-11-2003, 10:31 AM
With the legend open, you should be able to select and delete whole Pushpin sets.
Josemi
04-11-2003, 10:37 AM
Thanks for the answer, but I forgot to mention that I want to delete the from VB code.
I think it is not possible, I am looking for just the same thing.
But as I looked on many forums, I did not find anything about it, except this: replace the pushpins by "empty" icon's..
And that's what I did, it's not the most clean solution, but it works...
John Meyer
04-12-2003, 06:30 AM
Here is a sample to delete all pushpins
Dim objmap As MapPointCtl.Map
Dim objdataset As MapPointCtl.DataSet
Dim objRecordset As MapPointCtl.Recordset
Set objmap = Form1.MappointControl1.ActiveMap
For Each objdataset In objmap.DataSets
Set objRecordset = objdataset.QueryAllRecords
Do Until objRecordset.EOF
objRecordset.Pushpin.Delete
objRecordset.MoveNext
Loop
Next
another option is to open a new map without saving the current.
Form1.MappointControl1.ActiveMap.Saved = True
Form1.MappointControl1.NewMap (geoMapNorthAmerica)
Anonymous
04-29-2003, 06:01 AM
I think this is what you are looking for: (Delphi)
var
ONE: OleVariant;
myMap: TMap;
begin
ONE:=1;
...
myMap.DataSets[ONE].Delete;
This deletes all pushpins the myPushpins dataset. When you add a new pushpin the map, the MyPushpins dataset is recreated. It works as long as you don't have other datasets on your map though. If this is not the case, you would need to look for the proper dataset (myPushpins) first.
Hope it helps.
Pascal