Back to Devexpress

ProcessStartPolicy.ProcessStartFailedExceptionEventArgs.Throw Property

corelibraries-devexpress-dot-data-dot-utils-dot-processstartpolicy-dot-processstartfailedexceptioneventargs-365defe2.md

latest2.9 KB
Original Source

ProcessStartPolicy.ProcessStartFailedExceptionEventArgs.Throw Property

Gets or sets whether to throw an exception.

Namespace : DevExpress.Data.Utils

Assembly : DevExpress.Data.Desktop.v25.2.dll

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

Declaration

csharp
public bool Throw { get; set; }
vb
Public Property [Throw] As Boolean

Property Value

TypeDescription
Boolean

true to throw an exception; otherwise, false.

|

Remarks

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

csharp
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);  
    }  
}
vb
Public Class Form1  
    Shared Sub Main()  
        AddHandler DevExpress.Data.Utils.ProcessStartPolicy.Failed, AddressOf ProcessStartPolicy_Failed  
        Application.EnableVisualStyles()  
        Application.SetCompatibleTextRenderingDefault(False)  
        Application.Run(New Form1)  
    End Sub  

    Private Shared Sub ProcessStartPolicy_Failed(ByVal sender As Object, ByVal e As DevExpress.Data.Utils.ProcessStartPolicy.ProcessStartFailedExceptionEventArgs)  
        If TypeOf e.Exception Is Win32Exception Then  
            Dim si As System.Diagnostics.ProcessStartInfo = TryCast(sender, System.Diagnostics.ProcessStartInfo)  
            e.Throw = False  
            MessageBox.Show("File not found: " & si.FileName)  
        End If  
    End Sub  
End Class

See Also

ProcessStartPolicy.ProcessStartFailedExceptionEventArgs Class

ProcessStartPolicy.ProcessStartFailedExceptionEventArgs Members

DevExpress.Data.Utils Namespace