Skip to main content

Posts

Showing posts with the label today date

Validation for future date in c sharp dot net lanugage

Validation for future date in c sharp dot net lanugage you can write this code in validation class which you may have in common class file. public static bool IsNotFuturedt(DateTimePicker datpic) { if (datpic.Value.Date > DateTime.Now.Date) { MessageBox.Show("Please enter date less than today "); datpic.Value = DateTime.Now; datpic.Focus(); return false; } else { return true; } }