Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Windows form timer in State.Dataloaded

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Windows form timer in State.Dataloaded

    Hi,

    I was starting a timer with a code sample per below in State.Configure. It worked fine. I noticed some of the references examples (for example TriggerCustomEvent) show a timer being started/configured in State.DataLoaded instead. This also made a little more sense for my purpose, so I did the same. Same code. Just moved it to State.Dataloaded. The issue is that, although that code runs and the print verifies the timer was enabled, the timer never runs. If I move the same code block back up to State.Configure, it works fine again.

    Curious as to what the reason for this is?

    Code sample
    Code:
    // Adds the event and the event handler for the meth od that will
    // process the timer event to the timer.
    
    myTimer.Tick += new EventHandl er(TimerEventProcessor);
    // Sets the timer interval to X milliseconds.
    myTimer.Interval = 500; // ms
    myTimer.Enabled = true;
    //myTimer.Start();
    PPrint("BA Timer started with " + myTimer.Interval.ToString() +"ms");

    #2
    Hello pjsmith,

    The timer you are using should be replaced with System.Timers.Timer.
    The windows forms timer would no longer be used as NT8 now uses WPF, the WPF timers would be more appropriate to be used. Could you try the sample from the help guide in regard to the timers type and how its configured and see if you still have problems?



    I look forward to being of further assistance.

    Comment


      #3
      Hi - Good point, and that does, in fact, work fine moved into DataLoaded. Thank you.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      92 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      138 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      122 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      73 views
      0 likes
      Last Post PaulMohn  
      Working...
      X