hi
i use maskedtextbox for give persian datetime from user. my setting for my maskedtextbox is : mask= 0000/00/00 righttoleft=true
and my code for TypeValidationCompleted on maskedtextbox is :
private readonly Type dateTimeType = typeof(DateTime);
txtDateS.ValidatingType = dateTimeType;
------------------
private void maskedTextBox1_TypeValidationCompleted(object sender, TypeValidationEventArgs e)
{
MaskedTextBox mtb = (MaskedTextBox)sender;
if (!e.IsValidInput)
{
toolTip1.IsBalloon = true;
toolTip1.Show("date is not true", mtb, -100, -30, 5000);
mtb.Clear();
}
else
{
DateTime dt;
if (!DateTime.TryParse(e.ReturnValue.ToString(), out dt))
{
toolTip1.IsBalloon = true;
toolTip1.Show("date is not true ", mtb, -100, -30, 5000);
e.Cancel = true;
mtb.Clear();
}
}
}
now when i Typing in maskedtextbox 1394/02/28 is very good and work. but when i typing in maskedtextbox 1394/02/29 or 1394/02/30 or 1394/02/31 It does not work and give me datetime is not valid why ? why not work for 29 , 30 , 31 ?
how can i solve this problem?