Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

RichEditDocumentServer.UnhandledException Event

This event is raised when an exception unhandled by the RichEditDocumentServer occurs.

Namespace: DevExpress.XtraRichEdit

Assembly: DevExpress.RichEdit.v24.2.Core.dll

NuGet Package: DevExpress.RichEdit.Core

#Declaration

public event RichEditUnhandledExceptionEventHandler UnhandledException

#Event Data

The UnhandledException event's data class is RichEditUnhandledExceptionEventArgs. The following properties provide information specific to this event:

Property Description
Exception Gets the exception which triggers the UnhandledException event.
Handled Gets or sets whether the exception should be propagated upwards.

#Remarks

The UnhandledException event is helpful when you are unable to catch the exception which is likely to occur. The most common case is an attempt to save the document to a read-only or locked file. If you do not handle the UnhandledException event, the unhandled exception is thrown and the application crashes. All changes in the document are lost. To prevent this, handle the exception using the following code.

private void richEditDocumentServer1_UnhandledException(object sender, 
    DevExpress.XtraRichEdit.RichEditUnhandledExceptionEventArgs e)
{
    e.Handled = true;
    // Add your code to handle the exception.
    BeginInvoke(new MethodInvoker(delegate()
    {
        MessageBox.Show(e.Exception.Message, "The command is not completed!");
    }));
}
See Also