Spread Windows Forms 9.0 Product Documentation
ValidateMode Property
Example 


Gets or sets the validation mode during control input.
Syntax
'Declaration
 
Public Property ValidateMode As ValidateModeEx
'Usage
 
Dim instance As GcDateTimeCellType
Dim value As ValidateModeEx
 
instance.ValidateMode = value
 
value = instance.ValidateMode
public ValidateModeEx ValidateMode {get; set;}

Property Value

One of the ValidateModeEx enumeration values. The default is ValidateModeEx.ValidateEx.
Exceptions
ExceptionDescription
System.ComponentModel.InvalidEnumArgumentException A value that is not within the range of valid values for the enumeration was assigned to the property.
Remarks

If the ValidateMode property is set to ValidateModeEx.ValidateEx, the control performs strict validation such as checking for leap-years and non-existing date values. Also, automatic character filtering and field adjustments are made as the user enters data. For example, in the case of leap years, when the input mask is set to 'yyyy.MM.dd', the user will not be able to enter February 29th, 2003. If the input mask is set to 'dd.MM.yyyy', entering February 29th, 2003 will automatically adjust the 29th to the 28th as soon as the last 3 is entered for the year.

If this property is set to ValidateModeEx.Validate, the control performs loose validation which causes all fields to behave independently. For example, if the input mask is set to 'yyyy.MM.dd', the control allows you to enter a date such as February 31st, 2003 which normally does not exist as a date-time value. The following table shows the valid range for the fields when ValidateModeEx.Validate is used.

Fields Valid Range
yyyy 1 - 9999
yy 0 - 99
ee 1 - 99
MM 1 - 12
dd 1 - 31
HH 0 - 23
mm 0 - 59
ss 0 - 59

If this property is set to ValidateModeEx, the control does not perform any validation. The fields behave independently just as when set to ValidateModeEx.Validate. For example, if the input mask is set to 'yyyy.MM.dd', the control allows you to enter '0000.00.00' which is not a date-time value. The following table shows the valid range for the fields when ValidateModeEx is used:

Fields Valid Range
yyyy 0 - 9999
yy 0 - 99
ee 0 - 99
MM 0 - 99
dd 0 - 99
HH 0 - 99
mm 0 - 99
ss 0 - 99

This property only takes effect when entering data within the control. The date-time value is validated as soon as focus leaves the control.

During input, if the entered data is incomplete such as '2003.__.01', or a non date-time value such as '2002.02.31' is entered, the GcDateTime.Value property returns null.

Performing spin actions causes date-time values to carry on in any mode of the ValidateMode property. The valid range for the spin actions is equivalent to when entering data as shown in the tables above.
Example
This example uses the ValidateMode property.
GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType datecell = new GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType();
datecell.ValidateMode = GrapeCity.Win.Spread.InputMan.CellType.ValidateModeEx.ValidateNone;      
fpSpread1.Sheets[0].Cells[0, 0].CellType = datecell;
Dim datecell As New GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType()
datecell.ValidateMode = GrapeCity.Win.Spread.InputMan.CellType.ValidateModeEx.ValidateNone
FpSpread1.Sheets(0).Cells(0, 0).CellType = datecell
Requirements

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

See Also

Reference

GcDateTimeCellType Class
GcDateTimeCellType Members

 

 


Copyright © GrapeCity, inc. All rights reserved.