ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Core.Geoprocessing Namespace / Geoprocessing Class / ShowMessageBox Method
Pass messages from the result (IGPResult) of ExecuteToolAsync to be shown on the message box.
Header of the messages.
Geoprocessing message box style, for example, GPMessageBoxStyle.Default or GPMessageBoxStyle.Error
Title at the top bar of the message box.
Path to a icon image to be shown next to content header.
Example

In This Topic
    ShowMessageBox Method
    In This Topic
    Shows a messag box with Geoprocessing messages as formatted for the message box.
    Syntax
    Public Shared Sub ShowMessageBox( _
       ByVal messages As IEnumerable(Of IGPMessage), _
       ByVal content_header As String, _
       ByVal style As GPMessageBoxStyle, _
       Optional ByVal window_title As String, _
       Optional ByVal icon_source As String, _
       Optional ByVal parentViewModel As ViewModelBase _
    ) 

    Parameters

    messages
    Pass messages from the result (IGPResult) of ExecuteToolAsync to be shown on the message box.
    content_header
    Header of the messages.
    style
    Geoprocessing message box style, for example, GPMessageBoxStyle.Default or GPMessageBoxStyle.Error
    window_title
    Title at the top bar of the message box.
    icon_source
    Path to a icon image to be shown next to content header.
    parentViewModel
    Example
    How to pass parameter with multiple or complex input values
    {
      var environments = Geoprocessing.MakeEnvironmentArray(overwriteoutput: true);
    
      string toolName = "Snap_edit";  // or use edit.Snap
    
      // Snap tool takes multiple inputs each of which has
      // Three (3) parts: a feature class or layer, a string value and a distance
      // Each part is separated by a semicolon - you can get example of sytax from the tool documentation page
      var snapEnv = @"'C:/SnapProject/fgdb.gdb/line_1' END '2 Meters';'C:/SnapProject/fgdb.gdb/points_1' VERTEX '1 Meters';'C:/SnapProject/fgdb.gdb/otherline_1' END '20 Meters'";
    
      var infc = @"C:/SnapProject/fgdb.gdb/poly_1";
    
      var snapParams = Geoprocessing.MakeValueArray(infc, snapEnv);
    
      GPExecuteToolFlags tokens = GPExecuteToolFlags.RefreshProjectItems | GPExecuteToolFlags.GPThread | GPExecuteToolFlags.AddToHistory;
    
      IGPResult snapResult = Geoprocessing.ExecuteToolAsync(toolName, snapParams, environments, null, null, tokens).Result;
    
      // use the result as needed
    }
    How to use Geoprocessing public event
    {
      ArcGIS.Desktop.Core.Events.GPExecuteToolEvent.Subscribe(e =>
            {
              // Handle the event
              string id = e.ID;           // Same as history ID
              if (e.IsStarting == false)  // Execute completed
                _ = e.GPResult.ReturnValue;
              System.Windows.MessageBox.Show("event triggered.");
            });
      Geoprocessing.ExecuteToolAsync("management.GetCount", Geoprocessing.MakeValueArray(@"c:\shape_file.shp"));
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also