Spread Windows Forms 6.0 Product Documentation
MaximumValue Property
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread.CellType Namespace > NumberCellType Class : MaximumValue Property


Glossary Item Box

Gets or sets the maximum value allowed for user input.

Syntax

Visual Basic (Declaration) 
Public Property MaximumValue As Double
Visual Basic (Usage)Copy Code
Dim instance As NumberCellType
Dim value As Double
 
instance.MaximumValue = value
 
value = instance.MaximumValue
C# 
public double MaximumValue {get; set;}

Property Value

Double-precision, floating-point number representing the maximum value allowed in the cell

Exceptions

ExceptionDescription
System.ArgumentOutOfRangeException Specified value is beyond accepted limits

Remarks

The MinimumValue and MaximumValue properties limit the value that the user enters when editing the cell. It does not affect the data model and does not the limit the cell getting a value by other means, for example by means of a formula or code.

The built-in operators and built-in functions for use in formulas return results as a Double (15 digits).

Use the MinimumValue and MaximumValue properties to place range restrictions on user entry. For example the following code limits user input to values between 0 and 100.

   NumberCellType nct = new NumberCellType();
nct.MinimumValue = 0.0;
nct.MaximumValue = 100.0;
spread.Sheets[0].Cells[0,0].CellType = nct;

Use the MIN and MAX functions to place range restrictions on formula calculations. For example, the following code limits the summation calculation to values between 0 and 100.

   spread.Sheets[0].Cells[4,0].Formula = "MAX(0, MIN(SUM(A1:A4), 100))";

Example

This example sets several properties of a numeric format cell.
C#Copy Code
FarPoint.Win.Spread.CellType.NumberCellType num = new FarPoint.Win.Spread.CellType.NumberCellType();
num.DecimalPlaces = 3;
num.DecimalSeparator = ",";
num.FixedPoint = true;
num.LeadingZero = FarPoint.Win.Spread.CellType.LeadingZero.UseRegional;
num.MaximumValue = 50000.0;
num.MinimumValue = -1000.0;
num.NegativeFormat = FarPoint.Win.Spread.CellType.NegativeFormat.Parentheses;
num.NegativeRed = true;
num.Separator = "/";
num.ShowSeparator = true;
num.SpinButton = true;
num.SpinDecimalIncrement = 10;
num.SpinIntegerIncrement = 5;
num.SpinWrap = true;
fpSpread1.ActiveSheet.Cells[0, 0].CellType = num;
fpSpread1.ActiveSheet.Cells[0, 0].Value = -443.0908;
Visual BasicCopy Code
Dim num As New FarPoint.Win.Spread.CellType.NumberCellType()
num.DecimalPlaces = 3
num.DecimalSeparator = ","
num.FixedPoint = True
num.LeadingZero = FarPoint.Win.Spread.CellType.LeadingZero.UseRegional
num.MaximumValue = 50000.0
num.MinimumValue = -1000.0
num.NegativeFormat = FarPoint.Win.Spread.CellType.NegativeFormat.Parentheses
num.NegativeRed = True
num.Separator = "/"
num.ShowSeparator = True
num.SpinButton = True
num.SpinDecimalIncrement = 10
num.SpinIntegerIncrement = 5
num.SpinWrap = True
FpSpread1.ActiveSheet.Cells(0, 0).CellType = num
FpSpread1.ActiveSheet.Cells(0, 0).Value = 443.9098

Requirements

Target Platforms: 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

© 2002-2012 ComponentOne, a division of GrapeCity. All Rights Reserved.