6

I'm trying to create a button using VB.NET and ArcGIS 10 to clear the layers of my data frame.

I know how to add layers, but how do I delete/clear them?

6

The easiest way is to cast the Map to IMapLayers and call the IMapLayers.ClearLayers method which:

Removes all layers from the map.

  • How can I call IMapLayers.ClearLayers? Thank you – TitoGIS Dec 12 '12 at 11:12
  • 1
    Perhaps at this point it would help you to start with some high-level ArcObjects documentation on your own. The overview for esriCarto library contains lots of information that will be beneficial in your case. – Petr Krebs Dec 12 '12 at 13:18
  • 1
    Also the Working with the map article could help you. – Petr Krebs Dec 12 '12 at 13:20
  • Thank you again. I'll try to understand, but is my second day with this I'm lost. – TitoGIS Dec 12 '12 at 15:31
  • 2
    Great, you can learn a lot by browsing the documentation. Note you can also call DirectCast(Map, IMapLayers).ClearLayers() in VB.NET, where Map is an IMap variable. C# equivalent is ((IMapLayers)Map).ClearLayers();. – Petr Krebs Dec 12 '12 at 19:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.