Hello,
Can anybody help me please how to check whether the entered date in the maskedTextBox is a valid date/has correct date format?
Thanks in advance.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Feb 28, 2012, 9:34 AM
However, as long as 'datp' and 'com' are fields, this should work:
NelPosted Feb 29, 2012, 2:19 AM
VulpesPosted Feb 28, 2012, 7:48 AM
NelPosted Feb 28, 2012, 6:49 AM
if (maskedTextBox1.Text != " . .")
{
datp = DateTime.Parse(maskedTextBox1.Text);
com.Parameters.Add("@Data_otstran_rekl", OleDbType.Date).Value = datp;
}
else
{
com.Parameters.AddWithValue("@Data_otstran_rekl", DBNull.Value);
}
but because of the validation, this code can not be executed.
Can you help me please how to achieve this?
Thank you.
VulpesPosted Feb 27, 2012, 11:26 AM
Check out this MSDN link:
http://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.validatingtype.aspx
Prime bPosted Feb 27, 2012, 11:07 AM