DateTimePicker does not like MY time

tonofsteel

Freshman
Joined
Jul 10, 2003
Messages
35
I am trying to set my start time in a DateTimePicker control to 00:00 with the 24 hour clock.

I cannot change the time no matter what I do, it just tells me it is read only, or it could not convert the string to a datetime. So do you have to use the time NOW, or can it be selected at run time programatically???



Visual Basic:
        StartTime.CustomFormat = "yyyy-M-d:HH:mm"
        EndTime.CustomFormat = "yyyy-M-d:HH:mm"

        StartTime.Value = Convert.ToDateTime(DateTime.Today & ":00:00")
 
The Value and CustomFormat properties are not read-only, so
you should not have a problem setting them. You will have to
format the date to your custom format:

Visual Basic:
StartTime.Value = Convert.ToDateTime(DateTime.Today.ToString("yyyy-M-d:HH:mm"))
 
Back
Top