Occurs when the data binding layer throws an exception because of an invalid cell value.
Syntax
Example
The following code sample demonstrates how to use the DataError event to customize the feedback given to the end user when a data error occurs:
For an overview of how to handle events in Visual Basic or Visual C#, see
Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see
Consuming Events in the
.NET Framework Developer's Guide.
| Visual Basic | Copy Code |
|---|
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinTree
Private Sub ultraTree1_DataError(ByVal sender As Object, ByVal e As DataErrorEventArgs) Handles ultraTree1.DataError
If Not e.Exception Is Nothing AndAlso e.Exception.GetType() Is GetType(System.Data.ConstraintException) Then
e.ErrorText = "The value you entered is already in use; please select another."
e.DisplayMessageBox = True
Else
If Not e.Exception Is Nothing Then
MessageBox.Show(e.Exception.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error)
e.DisplayMessageBox = False
End If
End If
End Sub
|
| C# | Copy Code |
|---|
using Infragistics.Win; using Infragistics.Win.UltraWinTree; using System.Diagnostics;
private void ultraTree1_DataError(object sender, Infragistics.Win.UltraWinTree.DataErrorEventArgs e)
{
if ( e.Exception is System.Data.ConstraintException )
{
e.ErrorText = "The value you entered is
already in use; please select another.";
e.DisplayMessageBox = true;
}
else
if ( e.Exception != null )
{
MessageBox.Show( e.Exception.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error );
e.DisplayMessageBox = false;
}
} |
See Also