Infragistics(R) NetAdvantage(R) Windows Forms
MaxValue Property
See Also  Example E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace > UltraGridColumn Class : MaxValue Property

Specifies the maximum value that can be entered in the cell. Default value is null meaning no maximum constraint. The object assigned to this property should be the same type as the column's DataType or compatible otherwise it won't be honored.

Syntax

Visual Basic (Declaration) 
Public Property MaxValue As Object
C# 
public object MaxValue {get; set;}

Example

The following code shows how to set min and max constraints on a column. When the user attempts to exit the edit mode (for example by leaving the cell) after entering a value that doesn't satisfy MinValue or MaxValue constraint, the grid fires CellDataError event and shows an error message. You can show you own message by hooking into CellDataError. MinValue and MaxValue are object types, so you can assign a min value and max value for different column types.

Visual BasicCopy Code
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

  Private Sub Button19_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button19.Click

      Dim dateColumn As UltraGridColumn = Me.ultraGrid1.DisplayLayout.Bands(1).Columns("OrderDate")
      Dim numericColumn As UltraGridColumn = Me.ultraGrid1.DisplayLayout.Bands(2).Columns("Unit Price")

      ' Put min and max constraints on a date column.
      dateColumn.MinValue = New DateTime(1990, 1, 1)
      dateColumn.MaxValue = New DateTime(2010, 12, 31)

      ' Put a min value constraint on a numeric column.
      numericColumn.MinValue = 0.0

  End Sub
C#Copy Code
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void button19_Click(object sender, System.EventArgs e)
{

	UltraGridColumn dateColumn = this.ultraGrid1.DisplayLayout.Bands[1].Columns["OrderDate"];
	UltraGridColumn numericColumn = this.ultraGrid1.DisplayLayout.Bands[2].Columns["Unit Price"];

	// Put min and max constraints on a date column.
	dateColumn.MinValue = new DateTime( 1990, 1, 1 );
	dateColumn.MaxValue = new DateTime( 2010, 12, 31 );

	// Put a min value constraint on a numeric column.
	numericColumn.MinValue = 0.0;

}

See Also