date time picker null value

Posted on 2006-05-14
Last Modified: 2008-01-09

I am having trouble using the DateTimePicker control.  

I basically want to print out each time a user choses a date.  So I use the ValueChanged event.  

However everytime I run my program, the DateTimePicker starts with a null value.  I found this out by just having a messagebox display the dateTimePickerControl.value.

I have the Control on a panel that is not initially visible, so only when I change to that panel is where the right date gets displayed.

Since it is a null value any other methods that I run because of a date change crash my program.  

I was thinking of creating the control dynamically, but I was wondering if there was another way?
Question by:foobarr
    LVL 7

    Author Comment

    Well I change the messagebox to print out the Value of the control and it worked fine...but it only displays the date and time a generic way

    I need it formatted to yyyy-MM-dd cuz i'm using mysql so I need to use the control.text which gives me a null value when loading hte program up
    LVL 10

    Assisted Solution

    Just use the ToSting function & pass it the format you want
    LVL 69

    Accepted Solution

    Hi foobarr,

    See my article of January 2005 at


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
    Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    759 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

    14 Experts available now in Live!

    Get 1:1 Help Now