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


IMapDocument.New Method (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference (Carto)  

IMapDocument.New Method

Creates and opens a new map document in preparation for the contents to be retrieve or updated.

[Visual Basic .NET]
Public Sub New ( _
    ByVal sDocument As String _
)
[C#]
public void New (
    string sDocument
);
[C++]
HRESULT New(
  BSTR sDocument
);
[C++]

Parameters sDocument [in]
sDocument is a parameter of type BSTR

Product Availability

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

Description

Creates a new MapDocument with the specified filename on your system. Any MapDocument that is currently open will be closed. The new document is created and opened with a PageLayout containing one empty Map with the version information and DocumentFilename property set.

Remarks

When opening or creating a map document with the IMapDocument Open() or New() methods, you should always make subsequent calls to IActiveView::Activate() in order to properly initialize the display of the PageLayout and Map objects.  Call Activate() once for the PageLayout and once for each Map you will be working with.  If your application has a user interface, you should call Activate() with the hWnd of the application's client area.  If your application runs in the background and has no windows, you can always get a valid hWnd from the GDI GetDesktopWindow() function, part of the Win32 API.

See Also

IMapDocument Interface