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


IPageLayoutControlDefault.LoadMxFile Method (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (Controls)  

IPageLayoutControlDefault.LoadMxFile Method

Loads the specified map document into the PageLayout contained by the PageLayoutControl.

[Visual Basic .NET]
Public Sub LoadMxFile ( _
    ByVal fileName As String, _
    [ByVal password As Object] _
)
[C#]
public void LoadMxFile (
    string fileName,
    object password
);
[C#]

Optional Values

password   To indicate that this parameter is undefined, pass in Type.Missing.
[C++]
HRESULT LoadMxFile(
  BSTR fileName,
  VARIANT password
);
[C++]

Parameters fileName [in] fileName is a parameter of type BSTR password [optional] password is a parameter of type VARIANT
To indicate this parameter is undefined pass in a VARIANT with type VT_ERROR and scode value of DISP_E_PARAMNOTFOUND.

Product Availability

Available with ArcGIS Engine.

Description

Loads an map document into the PageLayoutControl. The map document can be an ArcMap document, an ArcMap template or an ArcReader document. Use the CheckMxFile method to determine if the specified map document is a valid map document.

Errors Returned

1018 800a03fa: The specified filename is invalid, the contents are corrupt or invalid
1019 800a03fb: The specified filename cannot be found
1020 800a03fc: The specified filename is invalid, the file cannot be opened
1021 800a03fd: The specified document has timed out
1031 800a0407: Password required to read this map document
1032 800a0408: The specified password is incorrect
1043 800a0413: The version of the specified document cannot be read by this software
1044 800a0414: The specified document can only be opened in the ArcReader application
1045 800a0415: The specified document does not allow access to internal objects
1065 800a0429: The specified Published Map File contains a Globe and cannot be open

Remarks

When LoadMXfile is used the user may be prompted for a password; refer to the tables below to determine when this may occur. Additionally, password prompts may be given if accessing MapDocuments using either the PageLayoutControl's PropertyPage, ArcMap or ArcReader; the tables also show in what circumstances this will occur.

Loading Map Documents (*.mxd, *.mxt, *.pmf) which reference IMS Services (with and without security)

Application No Secure Services MXD/ MXT/ PMF files Secure Servcies MXD/ MXT/ PMF files Secure Servcies (password cached) MXD/ MXT files Secure Servcies (password cached) PMF files
PageLayoutControl (programmatically) No Prompt Prompt No Prompt Prompt
PageLayoutControl (property pages) No Prompt Prompt No Prompt Prompt
ArcMap No Prompt Prompt No Prompt Prompt
ArcReader (PMF files only) No Prompt Prompt N/A No Prompt

* The Connection to the Internet server must have the Save User/ Password setting enabled. This can be set, for example, when using Add Internet Server in the Add Layers Dialog. Additionally, in the case of PMF files the ArcPublisher Cache password in PMF file setting must be enabled.

Loading Published Map Files (*.pmf) (with and without password protection)

Application PMF with No Password PMF with Password
PageLayoutControl (programmatically) No Prompt Supply in Code
PageLayoutControl (property pages) No Prompt Prompt
ArcMap No Prompt Prompt
ArcReader No Prompt Prompt

See Also

IPageLayoutControlDefault Interface | IPageLayoutControlDefault.CheckMxFile Method

.NET Samples

Use a PageLayoutControl as an overview window (Code Files: Overview)