Spread Windows Forms 7.0 Product Documentation
MaxLength Property
See Also  Example Support Options
GrapeCity.Win.PluginInputMan Assembly > GrapeCity.Win.Spread.InputMan.CellType Namespace > GcTextBoxCellType Class : MaxLength Property


Glossary Item Box

Gets or sets the maximum number of characters or bytes that the control can hold.

Syntax

Visual Basic (Declaration) 
Public Property MaxLength As Integer
Visual Basic (Usage)Copy Code
Dim instance As GcTextBoxCellType
Dim value As Integer
 
instance.MaxLength = value
 
value = instance.MaxLength
C# 
public int MaxLength {get; set;}

Property Value

The number of characters or bytes (determined by the LengthAsByte property) that can be entered into the control.
The default is zero.

Exceptions

ExceptionDescription
System.ArgumentOutOfRangeException If the value is less than zero, an ArgumentOutOfRangeException is thrown.

Remarks

The MaxLength property allows you to limit the number of characters a user can enter in the control. The default value is 0, which does not limit the number of characters. Any number greater than 0 indicates the maximum number of characters. The GcTextBox.MaxLengthUnit effects the display results with the MaxLength property.

Example

This example uses the MaxLength property.
C#Copy Code
GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType inputcell1 = new GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType();
inputcell1.MaxLengthUnit = GrapeCity.Win.Spread.InputMan.CellType.LengthUnit.Char;
inputcell1.MaxLength = 10;
fpSpread1.Sheets[0].Cells[1, 1].CellType = inputcell1;
VB.NETCopy Code
Dim inputcell1 As New GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType
inputcell1.MaxLengthUnit = GrapeCity.Win.Spread.InputMan.CellType.LengthUnit.Char
inputcell1.MaxLength = 10
FpSpread1.Sheets(0).Cells(1, 1).CellType = inputcell1

Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8

See Also

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