HOW TO

Remove a data frame from a map document using ArcObjects

Last Published: October 1, 2025

Summary

Instructions provided describe some sample code to remove a data frame from the page layout by calling the IGraphicsContainer::DeleteElement() method.

Procedure



  • [VB.NET]

    Code:
    Dim pMap As IMap = pMapDoc.Map(0)
    Dim pContainer As IGraphicsContainer = pMapDoc.PageLayout
    Dim pMapframe As IMapFrame = pContainer.FindFrame(pMap)
    pContainer.DeleteElement(pMapframe)

  • [C#]

    Code:
    IMap pMap = pMapDoc.get_Map(0);
    IGraphicsContainer pContainer = (IGraphicsContainer)pMapDoc.PageLayout;
    IMapFrame pMapframe = (IMapFrame)pContainer.FindFrame(pMap);
    pContainer.DeleteElement((IElement)pMapframe);

  • [JAVA]

    Code:
    IMap pMap = pMapDoc.getMap(0);
    IGraphicsContainer pContainer = (IGraphicsContainer)pMapDoc.getPageLayout();
    IMapFrame pMapframe = (IMapFrame)pContainer.findFrame(pMap);
    pContainer.deleteElement((IElement)pMapframe);

Article ID: 000013270

Software:
  • ArcObjects SDK for the Java Platform
  • ArcObjects SDK Microsoft NET Framework

Get support with AI

Resolve your issue quickly with the Esri Support AI Chatbot.

Start chatting now

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Start chatting now

Go to download options