This document is archived and information here might be outdated.  Recommended version.

IMapDocument.ReplaceContents Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Carto > ESRI.ArcGIS.Carto > Interfaces > IM > IMapDocument Interface > IMapDocument.ReplaceContents Method
ArcGIS Developer Help

IMapDocument.ReplaceContents Method

Replace the contents of the map document.

[Visual Basic .NET]
Public Sub ReplaceContents ( _
    ByVal pObject As IMxdContents _
public void ReplaceContents (
    IMxdContents pObject
HRESULT ReplaceContents(
  IMxdContents* pObject
pObject [in]

pObject is a parameter of type IMxdContents*

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.


Replaces the contents of the MapDocument with the contents of the specified Map, PageLayout, MapControl or PageLayoutControl. Before using the ReplaceContents method a New MapDocument must be created or an existing MapDocument must be Open.

If a MapControl  is passed to the ReplaceContents method the MapDocument will be replaced with the IMapControl2::Map. Likewise, if a PageLayoutControl is passed to the ReplaceContents method the MapDocument will be replaced with the IPageLayoutControl::PageLayout.

If the MapDocument contents is replaced with the contents of a Map or MapControl a portriat PageLayout containing the map will be created.


See Also

IMapDocument Interface

.NET Samples

Synchronized MapControl and PageLayoutControl application Save a layer file in a MapControl application Simple dynamic display application Schematics Engine application Temporal statistics Temporal statistics