Date & Time Edit Control Update

Recommended Posts


I am just programming a week timer giving the user the option to specify a "ON" time and "OFF" time for each day of the week.

I create a global variable in a sequence for each time on program start-up and specify the default time using:

global MontimeON = StrToTime("08:00:00","hms")

global MontimeOFF = StrToTime("18:00:00","hms")

global TuetimeON = ...


. and so on.

The user has 14No Time Edit screen components to change those default values.

The problem I have is that the Date & Time Edit screen component however doesn't update to the time I declared when creating the variable but shows the current system time instead on start-up.

I tried Page.UpdateEdits() but still no luck. Once I changed the time using the screen component itself it is displayed in there correctly.

Any ideas?


Link to comment
Share on other sites

First, don't use strToTime() to set a constant time. StrToTime() is really for when you are importing from a file (or serial stream) and need to convert from that string into time. Instead use hms notation. Its much faster:

global monTimeOn = 8h

global monTimeOff = 18h

But to answer your question: name each control, then use its Contents variable to set:

component.myMonTimeOnComponent.contents = monTimeOn

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.