Hello,

I have a GUI with a timer... but when I put too many lines of code inside the timer method, the GUI lags.

private void timer_tick(object sender, EventArgs e) { ... }

How could I resolve this problem? I know there are 3 types of timer... Do I use the correct one?

Any help is appreciated.

Edited 1 Year Ago by Navee30

What is the code doing? If it is on the main thread and it is doing a lot it can freeze the UI. Consider running the code on another thread.

Thanks for the reply.

The code only changes some labels on the main thread. How can I run the code in another thread?

Edited 1 Year Ago by Navee30

I mark this question as solved, but please could you show me how can I use BackgroundWorker in my case?

After adding the BW, I have backgroundWorker_DoWork() method. Where should I put the code for the labels? There? And that method runs at regular intervals?

Edited 1 Year Ago by Navee30

This question has already been answered. Start a new discussion instead.