setting default DateTime control
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: setting default DateTime control

  1. #1
    Join Date
    Nov 2012
    Posts
    12

    setting default DateTime control

    Hello!

    I have two dateTime controls, one for a start date of search and one for end date. I'm using the dates to search
    file creation dates and then storing them into a array. I would like to have the search include all files if a dateTime
    is not picked. Any suggestion about how to do this? Can you do it in the get; set ; ?

    Code:
         public DateTime startDate
            {
                get { return startDate; }
                set { startDate = value; }
            }
            public DateTime endDate
            {
                get { return endDate; }
                set { endDate = value; }
            }
    Thanks for your time in this for me

    Stevish

  2. #2
    Join Date
    Oct 2003
    Location
    .NET2.0 / VS2005 Developer
    Posts
    7,104

    Re: setting default DateTime control

    Ahh,, the age old ugliness of a nullable date time picker rears its head again..

    http://stackoverflow.com/questions/5...lue-to-be-null

    But i've most often found it to be a better UI design decision to put a separate checkbox next to the picker, and enable/disable the picker (or change its customformat from space, to yyyymmdd and back again) when the checkbox is checked/unchecked, so that people more obviously know what theyre searching for

    When it comes time to do the query, if checkbox is not checked, pass DateTime.Min/MaxValue depending on whether it's the date from, or date to, that is checked:

    Avoid the temptation to set the picker value to DateTime.MinValue because it loses the users previous choice, and puts them back a huge number of years which makes the ui a nuisance for them to use

    The checkbox inside the picker is too small to be helpful/usable I think
    "it's a fax from your dog, Mr Dansworth. It looks like your cat" - Gary Larson...DW1: Data Walkthroughs 1.1...DW2: Data Walkthroughs 2.0...DDS: The DataSet Designer Surface...ANO: ADO.NET2 Orientation...DAN: Deeper ADO.NET...DNU...PQ

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center