private void txtInDate_TextChanged(object sender, EventArgs e) { try { if (!IsLoading) { DateTime dt; if (GeneralMethods.IsDate(txtInDate.Text, out dt) & txtInDate.Text.Trim().Length == 10) { objVehInOut.InDate = Convert.ToDateTime(txtInDate.Text); } } } catch (Exception ex) { MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }