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


Glossary Item Box

Gets or sets the maximum number of characters that can be typed or pasted into the control.

Syntax

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

Property Value

Integer maximum number of characters

Remarks

When the user or code attempts to insert or provide more characters than the maximum length of the control, a UserError event occurs. To prevent validation until the control loses focus, set the UserEntry property to UserEntry.FreeFormat. With the UserEntry property set to FreeFormat, if the user or code inserts or provides more characters than the maximum length of the control, an InvalidData event occurs when the control loses focus.

Caution: If the control is bound to a database field that contains more characters than the limit specified by the MaxLength property, the data from the database is truncated in the control. If the value changes, the changed, possibly truncated, value is written to the database.

This property is available at run time only.

Example

C#Copy Code
control.EditModeCursorPosition = FarPoint.Win.EditModeCursorPosition.LastKnownPosition;
control.Text = "This is a test for HideSelection";
control.ControlType = FarPoint.Win.ControlType.Normal;
control.SelectionStart = 2;
control.SelectionLength = 5;
control.Selectable = true;
control.HideSelection = false;
control.AutoMenu = true;
textBox1.Text = control.SelectedText();
control.MaxLength = 9;
Visual BasicCopy Code
control.EditModeCursorPosition = FarPoint.Win.EditModeCursorPosition.LastKnownPosition
control.Text = "This is a test for HideSelection"
control.ControlType = FarPoint.Win.ControlType.Normal
control.SelectionStart = 2
control.SelectionLength = 5
control.Selectable = True
control.HideSelection = False
control.AutoMenu = True
TextBox1.Text = control.SelectedText()
control.MaxLength = 9

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.