Spread Windows Forms 11.0 Product Documentation
CanValidate Property
Example 


FarPoint.Win Assembly > FarPoint.Win Namespace > SuperEditBase Class : CanValidate Property
Gets or sets whether the control validates data when it loses the focus.
Syntax
'Declaration
 
Public Overridable Property CanValidate As Boolean
'Usage
 
Dim instance As SuperEditBase
Dim value As Boolean
 
instance.CanValidate = value
 
value = instance.CanValidate
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
control.CanValidate=false;
control.CanValidate=False
See Also

Reference

SuperEditBase Class
SuperEditBase Members
InvalidColor Property
InvalidOption Property
UserEntry Property
InvalidData Event
UserError Event