Results 1 to 7 of 7

Thread: [RESOLVED] A quick date Picker Question.

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2003
    Location
    Out there somewhere!
    Posts
    386

    Resolved [RESOLVED] A quick date Picker Question.

    Hello

    In my VB6 program I have a text box that is populated by a date picker.

    When the form loads the date picker is set to Now.

    On the change event, of the date picker, I let the text box = date picker.value, however if the user clicks on todays date within the picker, which is the default value, the text box is not poplated. Anyway around this?


    Thanks

    Kev.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: A quick date Picker Question.

    In the _CloseUp event procedure you can place the same code in there too to populate the textbox upon closing of the dtp.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2003
    Location
    Out there somewhere!
    Posts
    386

    Re: A quick date Picker Question.

    Thanks RobDog888, works like a charm.


    Kev.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2003
    Location
    Out there somewhere!
    Posts
    386

    Re: [RESOLVED] A quick date Picker Question.

    It's an optional field used in a search, if the text box is empty then no date in the search criteria.


    Kev.

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] A quick date Picker Question.

    The dtp also supports Null dates. Set the CheckBox property to True. There will appear a small checkbox on the left side of the dtp. If they select a date then its checked. If they dont want a date then unchecked it. No textbox needed then
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [RESOLVED] A quick date Picker Question.

    Quote Originally Posted by Kev
    It's an optional field used in a search, if the text box is empty then no date in the search criteria.


    Kev.
    If you put a msgbox in the Change event, and click on today's date, the message box isn't displayed. For some reason, when you select today's date, the change event doesn't fire. I think it is because the date picker doesn't recognize today's date as a Change.

    Anyway, I usually place today's date in my textbox in the Form_Load. That way, if today's date is desired, no selection needs to be made.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2003
    Location
    Out there somewhere!
    Posts
    386

    Re: [RESOLVED] A quick date Picker Question.

    I didn't know about the check box property and Null dates, thanks again.

    Hack, the reason I leave the text box empty is that todays date is relevent in the search. I only want to use a date if the user enters one.


    Thanks gain though.

    Kevin.

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