Clear DateTimePicker

Posted on 2007-08-07
Last Modified: 2013-11-26
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
Question by:AWestEng
    LVL 38

    Expert Comment

    In form_load, I usually set it to today's date:

    DateTimePicker1.Value = Today

    I don't think there's anyway to clear it.
    LVL 27

    Assisted Solution

    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.

    LVL 6

    Expert Comment

    You also need to set:

    Me.DateTimePicker.Format= DateTimePickerFormat.Custom

    ... or select Custom format this in the properties toolbox
    LVL 6

    Accepted Solution

    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 = " "
    LVL 69

    Assisted Solution

    by:Éric Moreau
    LVL 38

    Expert Comment

    Nice article, emoreau.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
    The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
    THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now