Spread Windows Forms 15.0
GrapeCity.Win.PluginInputMan Assembly / GrapeCity.Win.Spread.InputMan.CellType Namespace / GcDateTime Class / ValidateMode Property


In This Topic
    ValidateMode Property (GcDateTime)
    In This Topic
    Gets or sets the validation mode during input for the control.
    Syntax
    'Declaration
     
    
    Public Property ValidateMode As ValidateModeEx
    'Usage
     
    
    Dim instance As GcDateTime
    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
    A value that is not within the range of valid values for the enumeration was assigned to the property.
    Remarks

    If setting the ValidateMode property to ValidateModeEx.ValidateEx, the control will perform strict validation such as checking for leap-years and non-existing date values. Also, automatic character filtering and field adjustments will be 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 setting this property to ValidateModeEx.Validate, the control will perform loose validation causing all fields to behave independently and not rely on each other. 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 cannot exist as a date-time value. The following table shows the valid range for the fields when the mode is ValidateModeEx.Validate.

    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 setting this property to ValidateModeEx, the control does not perform 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 using ValidateModeEx:

    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 takes effect only when entering data in the control. The date-time value is validated as soon as focus moves away from 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 Value property returns null.

    Performing spin actions causes date-time values to change in any mode of the ValidateMode property. The valid range for the spin actions is equivalent to entering data as shown in the tables above.
    See Also