Spread for ASP.NET 11 Product Documentation
MaxLength Property
Example 


FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > TextCellType Class : MaxLength Property
Gets or sets the maximum length of text in the cell.
Syntax
'Declaration
 
Public Property MaxLength As Integer
'Usage
 
Dim instance As TextCellType
Dim value As Integer
 
instance.MaxLength = value
 
value = instance.MaxLength
public int MaxLength {get; set;}

Property Value

Integer number of characters in the length
Remarks

This property determines the maximum number of characters that can be entered in the text cell. You can use this property to restrict the length of text entered in the cell for values such as postal codes and telephone numbers, or to restrict the length of text entered when the data is to be entered in a database. You can limit the text entered into the cell to the maximum length of the corresponding field in the database. The value should be a positive, non-zero value.

Note: In code, you can set the value of the Text property or Value property to a value that has a length greater than the value specified by the MaxLength property. This property only affects text entered into the control at run time either by pasting or typing.

Example
This example sets the maximum size for a text cell by setting the length to five characters.
FarPoint.Web.Spread.TextCellType textcell = new FarPoint.Web.Spread.TextCellType();
textcell.MaxLength = 5; 
FpSpread1.Sheets[0].Cells[0, 0].CellType = textcell;

Dim textcell As New FarPoint.Web.Spread.TextCellType()
textcell.MaxLength = 5 
FpSpread1.Sheets(0).Cells(0, 0).CellType = textcell
See Also

Reference

TextCellType Class
TextCellType Members