I don\'t want the date to change when user clicks out of the calender without clicking on a date. The problem is One Date is always selected when the datepickercalendar open
An old thread but maybe someone finds this useful... If you're looking for DTP that opens "blank" and selects date only If user selects It, then this is (in my opinion) best and simplest option:
Private Sub Form_Load(sender As Object, e As EventArgs) Handles Form.Load
DTP_Example.Format = DateTimePickerFormat.Custom
DTP_Example.CustomFormat = " "
End Sub
Private Sub DTP_Example_ValueChanged(sender As Object, e As EventArgs) Handles DTP_Example.ValueChanged
DTP_Example.Format = DateTimePickerFormat.Long
End Sub
Private Sub DTP_Example_KeyDown(sender As Object, e As KeyEventArgs) Handles DTP_Example.KeyDown
If e.KeyCode = Keys.Delete Or e.KeyCode = Keys.Back Then
DTP_Example.Value = Now
DTP_Example.Format = DateTimePickerFormat.Custom
DTP_Example.CustomFormat = " "
End If
End Sub
This way you have DTP "blank" on open, and displays date If you select some. Also you can delete dates with "Backspace" or "Delete" keys and even select same date as before, which makes DTP simmilar behavior like combobox/textbox. Same "Backspace" behavior as in textbox/combobox can be achieved too, with a little more coding (using another Textbox to manually enter Dates), but in my opinion this is good enough. Cheers