Results 1 to 4 of 4

Thread: how to set datetimepicker default value to empty?

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2009
    Posts
    43

    how to set datetimepicker default value to empty?

    how to set datetimepicker default value to empty?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: how to set datetimepicker default value to empty?

    This doesn't really have anything to do with databases so it doesn't belong in the Database forum.

    If you're talking about a .NET DateTimePicker then it's not possible. The Value property of the DTP is type DateTime, which is a value type and not nullable. You can display a check box in the control and have an unchecked box indicate a null value, although the Value property will still contain a Date value. You can streamline things a bit by deriving your own class and adding the extra functionality. You'll find already made like that here.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Re: how to set datetimepicker default value to empty?

    Quote Originally Posted by lye85 View Post
    how to set datetimepicker default value to empty?
    I don't think this can be done in VB6. You could, instead have a label control cover up the datetimepicker control which would make it appear blank.

    What's your purpose in setting the default value to empty?
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  4. #4
    Junior Member
    Join Date
    Jun 2014
    Location
    Southern New Jersey
    Posts
    29

    Re: how to set datetimepicker default value to empty?

    Quote Originally Posted by lye85 View Post
    how to set datetimepicker default value to empty?
    I have resolved the problem for myself. I created an empty text box control. if the date is the default date the textbox is visible is true, if it has a valid date visibility is false. If it starts with a default value "01/01/1900" the text box covers it with an empty box. If the empty text box gets focus the visibility is set to false and the pick calendar is visible.

    Works good for me.

    Jim

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width