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
Open Microsoft Visual Studio 2015 and create a new windows form application.
Do the form just like shown below.
Double click the “Disable” button and add the following code to disable the previous date when the button is clicked.
- dateTimePicker1.MinDate = DateTime.Now;
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");