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


Glossary Item Box

Gets or sets whether the control validates data when it loses the focus.

Syntax

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

Property Value

Boolean value: true if the control validates data when it loses focus; false otherwise

Remarks

Set this property to false to prevent the edit control from validating its contents when the control loses the focus.

Caution: Be careful when setting this property to false, because data validation is turned off and invalid data is then allowed in the control. In this case, the invalid color and option settings specified by the InvalidColor and InvalidOption properties have no effect.

What makes a character valid depends on the control and its property settings.

If the CanValidate property is set to true and a control contains an invalid character or a value otherwise considered invalid when it loses the focus, an InvalidData event occurs, the control displays the color specified by the InvalidColor property, and it displays the invalid data as specified by the InvalidOption property. The control does not format the invalid value. If the value is valid, the control formats it, adding the defined symbols, such as a currency symbol, as specified by the related property settings.

Controls can also validate data as it is provided to the control. The UserEntry property specifies whether the control either blocks invalid characters from being provided to the control or lets the user or code provide any value. If the UserEntry property is set to UserEntry.Formatted, the control validates every character when it is provided to the control. The control blocks any character that does not fit its criteria for valid characters, and a UserError event occurs.

Example

C#Copy Code
control.CanValidate=false;
Visual BasicCopy Code
control.CanValidate=False

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.