Version

InvalidValueBehavior Property (UltraGridOverride)

Specifies the behavior when the user attempts to leave a cell after entering an invalid value. Default is resolved to RetainValueAndFocus.
Syntax
'Declaration
 
Public Property InvalidValueBehavior As InvalidValueBehavior
public InvalidValueBehavior InvalidValueBehavior {get; set;}
Remarks

InvalidValueBehavior property is used to specify what actions are taken by the UltraGrid when the user attempts to leave a cell after entering an invalid value. This property provides the default values for the properties on CellDataErrorEventArgs when it fires the UltraGrid.CellDataError event. Therefore the same functionality can be achieved by hooking into that event and setting the properties on the event args. Also the event args exposes other properties that control other aspects of the behavior.

Example
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid


    Private Sub UltraGrid1_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles ultraGrid1.InitializeLayout
        ' InvalidValueBehavior controls what happens when the user attempts to leave
        ' a cell after typing an invalid value. A value is considered to be invalid
        ' if it can't be converted to the data type of the column or if it doesn't
        ' meet the any of constraints specified on the column like the MaxValue,
        ' MinValue etc... Note: To further fine-grain the behavior hook into the
        ' CellDataError event. The associated event args exposes various properties
        ' that let you do the same as this property and in addition let you prevent
        ' the error message box from displaying.
        e.Layout.Override.InvalidValueBehavior = InvalidValueBehavior.RevertValue
    End Sub

    Private Sub UltraGrid1_CellDataError(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.CellDataErrorEventArgs) Handles ultraGrid1.CellDataError
        ' Prevent the message box from displaying.
        e.RaiseErrorEvent = False
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

		private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
		{
			// InvalidValueBehavior controls what happens when the user attempts to leave
			// a cell after typing an invalid value. A value is considered to be invalid
			// if it can't be converted to the data type of the column or if it doesn't
			// meet the any of constraints specified on the column like the MaxValue,
			// MinValue etc... Note: To further fine-grain the behavior hook into the
			// CellDataError event. The associated event args exposes various properties
			// that let you do the same as this property and in addition let you prevent
			// the error message box from displaying.
			e.Layout.Override.InvalidValueBehavior = InvalidValueBehavior.RevertValue;
		}

		private void ultraGrid1_CellDataError(object sender, Infragistics.Win.UltraWinGrid.CellDataErrorEventArgs e)
		{
			// Prevent the message box from displaying.
			e.RaiseErrorEvent = 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