Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 I don't have any idea on how to delete/clear them.

Any suggestions?

Thank you!

share|improve this question

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

share|improve this answer
Thank you... but I don't understand because I new doing this.. .... – TitoGIS Dec 12 '12 at 11:06
How can I call IMapLayers.ClearLayers? Thank you – TitoGIS Dec 12 '12 at 11:12
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
Also the Working with the map article could help you. – Petr Krebs Dec 12 '12 at 13:20
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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