How to Disable Previous Date in DateTimePicker Using C#
Submitted by janobe on Thursday, January 10, 2019 - 20:54.
In this tutorial I will teach you how to disable previous date in the datetimepicker using c#. This simple program will help you for filtering the date displayed in the datetimepicker. It will disable the dates in the calendar beyond the current date. Hope this simple program will help you if you encounter this kind of problem. Let’s begin.
Output
Creating a Program
Step 1
Open Microsoft Visual Studio 2015 and create a new windows form application.Step 2
Do the form just like shown below.Step 3
Double click the “Disable” button and add the following code to disable the previous date when the button is clicked.- dateTimePicker1.MinDate = DateTime.Now;
Step 4
Double click the “Enable” button and add the following code to enable the previous date when the button is clicked.- dateTimePicker1.MinDate = DateTime.Parse("01/01/1753");
Add new comment
- 409 views