• We just launched and are currently in beta. Join us as we build and grow the community.

How to Disable Previous Date in DateTimePicker Using C#

max61

Crypto Attack Strategist
M Rep
0
0
0
Rep
0
M Vouches
0
0
0
Vouches
0
Posts
166
Likes
47
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 200 XP
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.
creating_application_c_1.png

Step 2

Do the form just like shown below.
2019-01-10.png

Step 3

Double click the “Disable” button and add the following code to disable the previous date when the button is clicked.

  1. 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. dateTimePicker1.

    MinDate

    =

    DateTime.

    Parse

    (

    "01/01/1753"

    )

    ;

Output
2019-01-10_3.png


 

452,292

323,526

323,535

Top