Results 1 to 17 of 17

Thread: Question On Date Picker Control

  1. #1

    Thread Starter
    Frenzied Member SeanK's Avatar
    Join Date
    May 2002
    Location
    Boston MA
    Posts
    1,160

    Question On Date Picker Control

    Why doesn't this work:
    VB Code:
    1. Private Sub DTPicker1_Click()
    2. Text1.Text = DTPicker1.Value
    3. End Sub
    When I click on a date, nothing happens. I put a break at the beginning of this routine, and when I clicked nothing happened. This tells me the event, itself, is not firing and I don't know why.
    Last edited by SeanK; Jul 26th, 2005 at 07:03 AM.
    Beantown Boy
    Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.

  2. #2
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: Question On Data Picker Control

    Use the DTPicker1_Change() event.

    VB Code:
    1. Private Sub DTPicker1_Change()
    2. Text1.Text = DTPicker1.Value
    3. End Sub

  3. #3

    Thread Starter
    Frenzied Member SeanK's Avatar
    Join Date
    May 2002
    Location
    Boston MA
    Posts
    1,160

    Re: Question On Date Picker Control

    1. That works, but why doesn't the click event work?

    2. When I put the code in the Change event, and I scroll to a new month, dates get put in my textbox. I suppose that isn't the end of the world, but it looks kinda messy when I need to enter a date 4 months in the past, and while clicking back through the date picker, I get dates popping into the text box.

    See number 1. Why isn't the click event fireing?
    Beantown Boy
    Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.

  4. #4
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: Question On Date Picker Control

    True, i had this problem a couple of days ago. The thing with this control is that you have to click it many times before finding a date in the calendar, which is why i thinkthe author has disabled full click events. The only time it will react to the click event if you click this bit here (marked in blue).
    Attached Images Attached Images  

  5. #5
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Question On Date Picker Control

    You could also use the CloseUp event that is fired when the drop-down is closed.

  6. #6

    Thread Starter
    Frenzied Member SeanK's Avatar
    Join Date
    May 2002
    Location
    Boston MA
    Posts
    1,160

    Re: Question On Date Picker Control

    Quote Originally Posted by Joacim Andersson
    You could also use the CloseUp event that is fired when the drop-down is closed.
    Actually, I was doing that, but if I opened the date picker, but didn't want to actually select anything, it would pop today's date in the textbox when it closed, and that wasn't going to work.

    So, the consensus is that the click event is functionally useless for acutally selecting a date??? What's up with that?
    Beantown Boy
    Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.

  7. #7
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: Question On Date Picker Control

    VB Code:
    1. if DatePick.value = date then
    2. exit sub
    3. end if

    Date is a VB keyword, and has the contains the current date.

  8. #8

    Thread Starter
    Frenzied Member SeanK's Avatar
    Join Date
    May 2002
    Location
    Boston MA
    Posts
    1,160

    Re: Question On Date Picker Control

    Quote Originally Posted by I_Love_My_Vans
    VB Code:
    1. if DatePick.value = date then
    2. exit sub
    3. end if

    Date is a VB keyword, and has the contains the current date.
    Perhaps one out of 50 or 60 times will my user want the current date. Overwhelmingly, the date will either be from some month in the past, or some month in the future.

    It looks like I will have to live with using the Change event.

    Another question: My datepicker has a red circle (or oval) around the current date, which is fine, but it also has a gray circle (or oval) around the date I added it to my form. How do I get rid of that?
    Beantown Boy
    Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.

  9. #9
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Question On Date Picker Control

    but it also has a gray circle (or oval) around the date I added it to my form. How do I get rid of that?
    The gray circle signifies the current Value of the date picker. There is no way to get rid of it by setting a property. There may be a way using the API or Subclassing the control.

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

    Re: Question On Date Picker Control

    Quote Originally Posted by brucevde
    The gray circle signifies the current Value of the date picker. There is no way to get rid of it by setting a property. There may be a way using the API or Subclassing the control.
    Which means you should be able to get rid of it by doing
    VB Code:
    1. Private Sub Form_Load()
    2. DTPicker1.Value = Format(Now, "mm/dd/yyyy")
    3. End Sub

  11. #11
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Question On Date Picker Control

    Quote Originally Posted by Joacim Andersson
    You could also use the CloseUp event that is fired when the drop-down is closed.
    That also doesn't help if the user simply punches in the date (which is also why the changed event is better than the click even to detect changes.)


    Quote Originally Posted by Hack
    Which means you should be able to get rid of it by doing
    VB Code:
    1. Private Sub Form_Load()
    2. DTPicker1.Value = Format(Now, "mm/dd/yyyy")
    3. End Sub
    *stares incredulously (sp?) at that and goes HUH?!*

    Tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

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

    Re: Question On Date Picker Control

    Quote Originally Posted by techgnome
    *stares incredulously (sp?) at that and goes HUH?!*Tg
    Close your mouth, you will attract files...

    What is so hard to understand? If you set the default value to today, then you get the little red circle, but not the little gray circle.

  13. #13
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Question On Date Picker Control

    What you get is the little gray circle inside the little red circle.

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

    Re: Question On Date Picker Control

    Quote Originally Posted by Joacim Andersson
    What you get is the little gray circle inside the little red circle.
    Yes, but unless you are really looking, you won't notice it, and truthfully speaking, how many customers actually "look" at a screen. As long as it works, and nothing stands out as odd, they could use that date picker from now until forever, and never notice that the gray circle has moved inside the red circle.

  15. #15
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Question On Date Picker Control

    Then why bother moving it in the first place?

    Tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  16. #16
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Question On Date Picker Control

    Quote Originally Posted by Hack
    Close your mouth, you will attract files...
    That only works for tri-occular frogs... not gnomes....

    Tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

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

    Re: Question On Date Picker Control

    Quote Originally Posted by techgnome
    Then why bother moving it in the first place?

    Tg
    'Cause I have had customers notice there are are two ovals on the calendar, but I've never had one come back and say there are two ovals on the same date.

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