How to Disable Previous Date in DateTimePicker Using C#

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.

Creating a Program

Step 1

Open Microsoft Visual Studio 2015 and create a new windows form application. ps1\

Step 2

Do the form just like shown below. ps2

Step 3

Double click the “Disable” button and add the following code to disable the previous date when the button is clicked.
  1.  
  2. 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.
  1.  
  2. dateTimePicker1.MinDate = DateTime.Parse("01/01/1753");
Output ps3

Add new comment