PachinSV
PachinSV

Reputation: 3780

.NET DateTimePicker class

I'm using a DateTimePicker in a form and then showing the date and time I pick in an textbox. My problem is that when I select a date the first time, it shows me something like:

11/05/2011 09:17:29 p.m.

Then I pick another date and it shows me this:

19/05/2011 09:17:29 p.m.

Only the date is updated, why I can't update the time or how can I do it?

I'm doing the update with this line of code:

fecha.Text = dateTimePicker1.Value.ToString();

Upvotes: 0

Views: 286

Answers (1)

YetAnotherUser
YetAnotherUser

Reputation: 9346

You'll need to set myDateTimePicker.ShowUpDown = true for it to show\update the time. In that case also, one has to change the time in ui to be reflected into your code.

Upvotes: 2

Related Questions