Results 1 to 4 of 4

Thread: [RESOLVED] DateTimePicker value doesn't reflect in txtUpdatedOn.Text when I select...

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2014
    Posts
    328

    Resolved [RESOLVED] DateTimePicker value doesn't reflect in txtUpdatedOn.Text when I select...

    DateTimePicker value doesn't reflect in txtUpdatedOn.Text when I select it from DateTimePickerUPDT. It simply shows the current date in the textbox instead of what I selected. The following is the code:


    Code:
    Private Sub DateTimePickerUPDT_ValueChanged(sender As Object, e As EventArgs) Handles DateTimePickerUPDT.ValueChanged
            DateTimePickerUPDT.Format = DateTimePickerFormat.Custom
            DateTimePickerUPDT.CustomFormat = "MMMM dd, yyyy - dddd"
            Me.txtUpdatedOn.Text = Format(Now, "Short Date")
    End Sub
    How to resolve it? Please help.

  2. #2
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,758

    Re: DateTimePicker value doesn't reflect in txtUpdatedOn.Text when I select...

    Code:
    Me.txtUpdatedOn.Text = Format(Now, "Short Date")
    Thats because you are telling it to show the current date
    Try this...
    Code:
    Me.txtUpdatedOn.Text = Format(DateTimePickerUPDT.Value, "Short Date")
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

  3. #3
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,537

    Re: DateTimePicker value doesn't reflect in txtUpdatedOn.Text when I select...

    additionally these properties should only need to be set once:
    DateTimePickerUPDT.Format = DateTimePickerFormat.Custom
    DateTimePickerUPDT.CustomFormat = "MMMM dd, yyyy - dddd"

    Generally done during design... not each time a date is selected. If not at design time, then at worst, during the FormLoad event.

    -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??? *

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2014
    Posts
    328

    Re: DateTimePicker value doesn't reflect in txtUpdatedOn.Text when I select...

    Thanks to both of you for the help.

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