Value Of DatetimePicker Not Changes With System Date

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maheshwag
    New Member
    • Aug 2010
    • 71

    Value Of DatetimePicker Not Changes With System Date

    I have a datetimepciker and set the time as below:
    Code:
    dateTimePicker1.Format = DateTimePickerFormat.Custom;
    dateTimePicker1.CustomFormat = "hh:mm:tt";
    But it's not changes it's time with system time. it's just showing time like sticky it's value is not changing with system time.

    how to set it with keeping changes time with system time?.
  • arie
    New Member
    • Sep 2011
    • 64

    #2
    Did you assign
    Code:
    dateTimePicker1.Value
    somewhere? If not, try to do it in dateTimePicker1 Load event. Maybe your CustomFormat is interferring somehow?

    Comment

    • maheshwag
      New Member
      • Aug 2010
      • 71

      #3
      arie,

      sorry but there is no datetimepicker_ load event at system. and I think the value already assigned by custom but problem is that it is not keep changes with system.

      Comment

      • arie
        New Member
        • Sep 2011
        • 64

        #4
        Sorry, I ment Form_Load event (to initialize the Value), my mistake :(

        As far as I understand it (here http://msdn.microsoft.com/en-us/library/xdtd4tst.aspx is my source of "understanding" )you have to update the Value yourself if you want it changing with system time. I think you may use a Timer, or datetimepicker_ Enter event (there is one, I checked properly this time :)), because it won't change on its own after it's created.

        Comment

        Working...