Okay, I admit in advance I am well out of practice.
But this is driving me mad. I want to check for a valid date on my webform. It can be US or UK/European formats so I'm adding .CultureInvariantValues = True.
But whatever gibberish I type in the textbox is accepted as valid.
What on earth am I missing?
Dim datecheck As New CompareValidator
With datecheck
.ControlToValidate = Me.visitdate.Text
.Type = ValidationDataType.Date
.Operator = ValidationCompareOperator.DataTypeCheck
.CultureInvariantValues = True
End With
If datecheck.IsValid Then
'Me.lblnodate.Visible = False
Stop
Exit Sub
Else
'Me.lblnodate.Visible ="Invalid"
stop
end if
But this is driving me mad. I want to check for a valid date on my webform. It can be US or UK/European formats so I'm adding .CultureInvariantValues = True.
But whatever gibberish I type in the textbox is accepted as valid.
What on earth am I missing?
Dim datecheck As New CompareValidator
With datecheck
.ControlToValidate = Me.visitdate.Text
.Type = ValidationDataType.Date
.Operator = ValidationCompareOperator.DataTypeCheck
.CultureInvariantValues = True
End With
If datecheck.IsValid Then
'Me.lblnodate.Visible = False
Stop
Exit Sub
Else
'Me.lblnodate.Visible ="Invalid"
stop
end if