private Boolean validateDate(string businessDate) { Boolean dateValidationResult = true; try { IFormatProvider culture = new CultureInfo("fr-FR",true); DateTime.ParseExact(businessDate, "dd/MM/yyyy", culture); } catch (Exception exceptionObject) { dateValidationResult = false; } return dateValidationResult; }if (this.validateDate(businessDateTextBox.Text)== false) { MessageBox.Show("Please write Accurate Business Date"); businessDateTextBox.Focus(); validationResult = false; }
private Boolean validateDate(string businessDate) { Boolean dateValidationResult = true; try { IFormatProvider culture = new CultureInfo("fr-FR",true); DateTime.ParseExact(businessDate, "dd/MM/yyyy", culture); } catch (Exception exceptionObject) { dateValidationResult = false; } return dateValidationResult; }
if (this.validateDate(businessDateTextBox.Text)== false) { MessageBox.Show("Please write Accurate Business Date"); businessDateTextBox.Focus(); validationResult = false; }