Skip to main content
All docs
V24.1

ProcessStartPolicy.Failed Event

Allows you to respond to associated failures.

Namespace: DevExpress.Data.Utils

Assembly: DevExpress.Data.Desktop.v24.1.dll

NuGet Packages: DevExpress.Data.Desktop, DevExpress.ExpressApp.Win.Design

Declaration

public static event EventHandler<ProcessStartPolicy.ProcessStartFailedExceptionEventArgs> Failed

Event Data

The Failed event's data class is ProcessStartPolicy.ProcessStartFailedExceptionEventArgs. The following properties provide information specific to this event:

Property Description
Exception Gets the exception.
Throw Gets or sets whether to throw an exception.

Remarks

The following example demonstrates how to suppress an internal exception and display a message box:

static void Main() {  
    DevExpress.Data.Utils.ProcessStartPolicy.Failed += ProcessStartPolicy_Failed;  
    //...  
}  

private static void ProcessStartPolicy_Failed(object sender, DevExpress.Data.Utils.ProcessStartPolicy.ProcessStartFailedExceptionEventArgs e) {  
    if(e.Exception is Win32Exception) {  
        System.Diagnostics.ProcessStartInfo si = sender as System.Diagnostics.ProcessStartInfo;  
        e.Throw = false;  
        MessageBox.Show("File not found: " + si.FileName);  
    }  
}

Tip

Exceptions are not raised if a process fails to start. Call the static ThrowOnErrors() method at application startup to throw exceptions.

Read the following topic for more information: Suppress New Processes Initiated by .NET Controls.

See Also