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


Open MxDialog Snippet (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference

Open MxDialog Snippet

Use the ShowDialog to open an MxDialog.

[C#]
///<summary>Use the ShowDialog to open an MxDialog.</summary>
///  
///<param name="application">An IApplication interface.</param>
///<param name="esriMxDlgID">An esriMxDlgIDs enumeration that is the type of dialog to open. Example: ESRI.ArcGIS.ArcMapUI.esriMxDlgIDs.esriMxDlgOptions</param>
///   
///<remarks>Refer to the EDN document http://edndoc.esri.com/arcobjects/9.1/default.asp?url=/arcobjects/9.1/ComponentHelp/esriArcMapUI/esriMxDlgIDs.htm for a listing of available esriMxDlgIDs that can be used as the esriMxDlgID parameter.</remarks>
public void OpenMxDialog(ESRI.ArcGIS.Framework.IApplication application, ESRI.ArcGIS.ArcMapUI.esriMxDlgIDs esriMxDlgID)
{
  if(application == null)
  {
    return;
  }
  System.Int32 dialogID=(System.Int32)esriMxDlgID; // example: ESRI.ArcGIS.ArcMapUI.esriMxDlgIDs.esriMxDlgOptions

  if (!application.IsDialogVisible(dialogID))
  {
    System.Object optionalParam=System.Type.Missing;
    application.ShowDialog(dialogID, ref optionalParam);
  }
}
[Visual Basic .NET]
'''<summary>Use the ShowDialog to open an MxDialog.</summary>
'''  
'''<param name="application">An IApplication interface.</param>
'''<param name="esriMxDlgID">An esriMxDlgIDs enumeration that is the type of dialog to open. Example: ESRI.ArcGIS.ArcMapUI.esriMxDlgIDs.esriMxDlgOptions</param>
'''   
'''<remarks>Refer to the EDN document http://edndoc.esri.com/arcobjects/9.1/default.asp?url=/arcobjects/9.1/ComponentHelp/esriArcMapUI/esriMxDlgIDs.htm for a listing of available esriMxDlgIDs that can be used as the esriMxDlgID parameter.</remarks>
Public Sub OpenMxDialog(ByVal application As ESRI.ArcGIS.Framework.IApplication, ByVal esriMxDlgID As ESRI.ArcGIS.ArcMapUI.esriMxDlgIDs)

  If application Is Nothing Then
    Return
  End If

  Dim dialogID As System.Int32=CInt(esriMxDlgID) ' example: ESRI.ArcGIS.ArcMapUI.esriMxDlgIDs.esriMxDlgOptions

  If (Not application.IsDialogVisible(dialogID)) Then
    Dim optionalParam As System.Object=System.Type.Missing
    application.ShowDialog(dialogID, optionalParam)
  End If

End Sub

Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.ArcMapUI
  • ESRI.ArcGIS.Framework
  • System