DateTimePicker Value...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mcfly1204
    New Member
    • Jul 2007
    • 233

    DateTimePicker Value...

    I am using a DateTimePicker in a Windows Form app., but the value is always the current date. I am displaying the value of the picker in a label when a button is clicked, but the value does not change even though the picker shows the newly selected date. What am I missing here?

    Code:
    lblTest.Text = dtPicker.Value.ToString();
  • Bassem
    Contributor
    • Dec 2008
    • 344

    #2
    When do you set the lblTest.Text, post the full code because there is no problem in what you posted.

    Comment

    • mcfly1204
      New Member
      • Jul 2007
      • 233

      #3
      Code:
       private void button1_Click(object sender, EventArgs e)
              {
                  label1.Text = dtpFollowup.Value.ToString(); ;
              }

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Are you sure you don't accidently have one dtp on top of the other?
        I have no problems using a DateTimePicker' s value

        Comment

        • Bassem
          Contributor
          • Dec 2008
          • 344

          #5
          I'm sure that there is another piece of code that change dtpFollowup.Val ue or if you've more than one DateTimePicker it maybe not the one you test.

          Comment

          • mcfly1204
            New Member
            • Jul 2007
            • 233

            #6
            Originally posted by Plater
            Are you sure you don't accidently have one dtp on top of the other?
            I have no problems using a DateTimePicker' s value
            Go figure. I assumed it had to be something such as this given it is not a complex process.

            Comment

            Working...