Version

DataError Event

Occurs when the data binding layer throws an exception because of an invalid cell value.
Syntax
'Declaration
 
Public Event DataError As DataErrorEventHandler
public event DataErrorEventHandler DataError
Event Data

The event handler receives an argument of type DataErrorEventArgs containing data related to this event. The following DataErrorEventArgs properties provide information specific to this event.

PropertyDescription
Cell (Inherited from Infragistics.Win.UltraWinTree.CellEventArgs)Returns the UltraTreeNodeCell object for which this instance was created.
Column (Inherited from Infragistics.Win.UltraWinTree.CellEventArgs)Returns the UltraTreeNodeColumn for which this instance was created.
DisplayMessageBox Gets/sets whether a MessageBox is displayed to the end user. By default, the property returns true, and a MessageBox is displayed to the end user; set the property to false to prevent it from displaying.
ErrorText Gets/sets the text which contains the error message that is displayed to the end user.
Exception Returns the Exception that caused the event to be fired.
InvalidValue Returns the value that caused the data error.
Node (Inherited from Infragistics.Win.UltraWinTree.CellEventArgs)Returns the UltraTreeNode for which this instance was created.
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.

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
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;
			}
		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also