Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateTimePicker Date and Time 1

Status
Not open for further replies.

schwarem

Programmer
Apr 18, 2002
159
0
0
US
How do I select the date and the time with the DateTimePicker. It seems that I can do either the date or the time, but not both.
 
Hello,

Are you talking about displaying the date and the time.

You can do this
Code:
Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged
        Me.TextBox1.Text = Me.DateTimePicker1.Value
    End Sub

If you are talking about selecting the date and the time? If you select the date the time is always included.

Hope that helps,

R
 
You will need to set the Format property of your DateTimePicker to "Custom" and set the Custom Format property to include the time, like "dd-MMM-yyyy hh:mm". I tested this and it still only shows the calendar control when you click the drop down arrow, but you can highlight the components of the time and manually enter new values.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top