Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

DataRepeaterDataErrorEventArgs.Exception Property

Gets the Exception that represents the error.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

public Exception Exception { get; }

Property Value

Type: System.Exception
The exception object that represents the error.

The DataError event enables you to handle exceptions that are thrown in code that is called by a DataRepeater control during data processing operations.

The Exception property contains information about the error that can be used to prompt the user for a correction or to write to an error log.

The following example demonstrates how to use the data from a DataRepeaterDataErrorEventArgs to display a message when a data error occurs.

private void dataRepeater1_DataError(object sender, 
    Microsoft.VisualBasic.PowerPacks.DataRepeaterDataErrorEventArgs e)
{
    string ErrorMsg;
    // Create an error string.
    ErrorMsg = "Invalid value entered for " + e.Control.Name + ". ";
    ErrorMsg = ErrorMsg + e.Exception.Message;
    // Display the error to the user.
    MessageBox.Show(ErrorMsg);
    // Do not raise an exception.
    e.ThrowException = false;
}

Show:
© 2015 Microsoft