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.
Open Microsoft Visual Studio 2015 and create a new windows form.
Add the DateTimePicker and two buttons inside the form. It will look like this.
Press F7 to open the code editor. In the code editor, create a sub-procedure for setting up the minimum date of the datetimepicker.
- Private Sub mindate(ByVal str_date As String)
- DateTimePicker1.MinDate = str_date
- End Sub
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.
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.
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