How to Disable the Previous Date in the DateTimePicker Using VB.Net

In this tutorial, I will teach you how to disable the previous date in the datetimepicker using vb.net. This method the ability to remove the previous date in the datetimepicker and show the current and future dates. This program will help you if you are developing a booking system or a reservation system.

Creating Application

Step 1

Open Microsoft Visual Studio 2015 and create a new windows form. ps2

Step 2

Add the DateTimePicker and two buttons inside the form. It will look like this. ps2

Step 3

Press F7 to open the code editor. In the code editor, create a sub-procedure for setting up the minimum date of the datetimepicker.
  1.  
  2. Private Sub mindate(ByVal str_date As String)
  3. DateTimePicker1.MinDate = str_date
  4. End Sub

Step 4

Double click an “Enable” button to open the click event handler of it and do the following code to enable the previous date of the datetimepicker.
  1.  
  2. mindate("01/01/1753")

Step 5

Double click a “Disable” button to open the click event handler of it and do the following code to disable the previous date of the datetimepicker.
  1.  
  2. mindate(Now)
The complete source code is included. You can download it and run it on your computer. For any questions about this article. You can contact me @ Email – [email protected] Mobile No. – 09305235027 – TNT Or feel free to comment

Add new comment