#8072
Support 1
Participant

Thanks for your enquiry.

To create a handler for DateTimePicker’s OnChange event, double-click the edit box at OnChange in the Object Inspector. For a DateTimePicker named Picker1, this creates a Sub like that shown below:

Sub Picker1Change(Sender)

End Sub

There is no Value property for DateTimePicker (the Object Inspector displays the properties Date and Time).

If MainForm has a Label named Label1 for displaying the date as it changes, you could modify the handler as below:

Sub Picker1Change(Sender)

  MainForm.Label1.Caption = DateToStr(MainForm.Picker1.Date)

End Sub

You can also use the VBScript functions listed below to help with formatting date/time values:

Hour
Minute
Second
Weekday
Day
Month
Year

You may find it helpful to compare DateTimePicker with the RzDateTimeEdit control (on the Enhanced tab). This control has the event OnDateTimeChanged along with a range of different properties.

I hope this helps.

Regards,
Advansys Support