• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5284
  • Last Modified:

Clear DateTimePicker

Hi guys..

I like to clear my DateTimePicker before the user "insert" the date

I tried
Me.DateTimePicker.CustomFormat = "MM/dd/yyyy"

but i start vith the value is has from the designer
0
AWestEng
Asked:
AWestEng
3 Solutions
 
PaulHewsCommented:
In form_load, I usually set it to today's date:

DateTimePicker1.Value = Today

I don't think there's anyway to clear it.
0
 
VBRocksCommented:
You know what might be a good idea, and I do this myself, is instead of using a DateTimePicker control,
use a regular TextBox; because a DateTimePicker control cannot have a null, nothing or "", but a
TextBox can.  Then, you can just create another Form with the Calendar control on it, or whatever,
and select the date from there, then retrieve the date that the user selects and load it into the TextBox.

0
 
ToFroCommented:
You also need to set:

Me.DateTimePicker.Format= DateTimePickerFormat.Custom

... or select Custom format this in the properties toolbox
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
ToFroCommented:
Try this:

        DateTimePicker1.Format = DateTimePickerFormat.Custom
        DateTimePicker1.CustomFormat = "MM/dd/yyyy"


Or this if you want it to be empty:

        DateTimePicker1.Format = DateTimePickerFormat.Custom
        DateTimePicker1.CustomFormat = " "
0
 
Éric MoreauSenior .Net ConsultantCommented:
0
 
PaulHewsCommented:
Nice article, emoreau.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now