Results 1 to 4 of 4

Thread: datetime picker conversion

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2013
    Posts
    95

    datetime picker conversion

    Code:
    Public Class Form1
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Me.TextBox1.Text = Me.DateTimePicker1.Value.ToFileTime
        End Sub
    End Class
    At this point, once button1 is clicked it displays the datepicker1 value in textbox1, but what I need it to due is every time the button is clicked it updates the text within textbox1. My ultimate goal is to convert the value from two datetimepicker to its numerical equivalent and subtract the values from the two datetimepickers.
    Thank you

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,988

    Re: datetime picker conversion

    As you currently have it written, every time you click the button the text in the textbox is updated with the value from the datetimepicker, so it is doing exactly what you say you want. You can see this by clicking the button, changing the value of the DTP, then clicking the button again.

    Therefore, I'm not sure what it is you really want.
    My usual boring signature: Nothing

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2013
    Posts
    95

    Re: datetime picker conversion

    Sorry. I meant it is NOT doing what I want it to do. That is every time I click the button I would like it to update.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: datetime picker conversion

    Quote Originally Posted by pooky View Post
    Sorry. I meant it is NOT doing what I want it to do. That is every time I click the button I would like it to update.
    But the code you have provided DOES do what you SAY you want it to do. Each time the Button is clicked, the Text of the TextBox will be updated based on the Value of the DateTimePicker. If that's not what you're seeing then the issue is not the code. If that is what you're seeing but it's not what you want then the problem is apparently that you are unable to provide a CLEAR explanation of what it is that you want. Try again. Explain EXACTLY what you expect to happen and EXACTLY what does happen. Provide a few examples even. We can't see what you're seeing and we certainly can't see what you're thinking. It's up to you to provide ALL the relevant information.

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