Delete previous pushpins

nasirgul
04-15-2008, 08:42 PM
Hi,
I cant able to resolve the problem of deleting previous pushpin and get mine visible pushpin only. I tried for deleting PP dataset and then add new one but not able to get control on program. ....please let me help to come out of this problem. Any one who knows C#.... object o = "Pushpins";
Pushpin a =null;
a= axMappointControl1.ActiveMap.AddPushpin(loc, "hi");
try
{

//MapPoint.DataSet Pushpins = axMappointControl1.ActiveMap.DataSets.get_Item(ref o);
MapPoint.Recordset rs = axMappointControl1.ActiveMap.DataSets.get_Item(ref o).QueryAllRecords();
MapPoint.DataSet pushpin = axMappointControl1.ActiveMap.DataSets.AddPushpinSe t("new");
a.Delete();
rs.MoveFirst();
while (!rs.EOF)
{
axMappointControl1.ActiveMap.DataSets.ZoomTo();
rs.Pushpin.MoveTo(pushpin);
rs.MoveNext();
}

}
catch { }
}

Wilfried
04-16-2008, 04:58 AM
Hi,

This delete all your pushpins:


object o = "My Pushpins";
try {
MapPoint.DataSet ds = MP.ActiveMap.DataSets.get_Item(ref o);
ds.Delete();
catch {
// Dataset does not exists
}

nasirgul
04-16-2008, 06:52 AM
Thanks. Mine code is deleting previous Pushpin but I want mainting mine current pushpin visible. Lets say if I insert the lat & lon it will show on Map. Next when I put again Lat & Lon I want mine previous Pushpin to be delete and keep mine current pushpin visible. I tried with your mentioned code but it delete pushpin with in second.
MapPoint.Map MP = axMappointControl1.ActiveMap;
Pushpin pp = null;
pp = MP.AddPushpin(loc,"hi");
object o = "My Pushpins";
try
{
MapPoint.DataSet ds = axMappointControl1.ActiveMap.DataSets.get_Item(ref o);
ds.Delete();
}
catch{}
}





Hi,

This delete all your pushpins:


object o = "My Pushpins";
try {
MapPoint.DataSet ds = MP.ActiveMap.DataSets.get_Item(ref o);
ds.Delete();
catch {
// Dataset does not exists
}

nasirgul
04-16-2008, 07:45 AM
Hi,
Thanks Its working now. Thanks once again to Mike Mattys. What i did i creat a dataset in which i inserted pp.delete(); and then I add new pushpins. now it works fine... Thanks u people.
Regards.
Nasir

 
Web mp2kmag.com
mapforums.com