Answer the question
In order to leave comments, you need to log in
How to properly display timer values from an instance of your own class in C# on the form?
You need to create a class with a timer. That is, each instance of the class must have its own timer. How to make it so that when the timer fires, its values are updated on the form?
Answer the question
In order to leave comments, you need to log in
Depends on the number of instances of this class and what they do besides this, and on the required precision. Because the timer is not a RealTime stream, its event will not happen "exactly" after 5 minutes, but after 5 minutes + "as the stream hangs", so if the timers work in the "changed" mode every 4 ms, for example, and they will be, say 10, then in a couple of hours the number of their operations will disperse decently, that is, there will be no synchronization.
In the simplest case, where there is no need for synchronization and there will be few of them, it will be easiest to start a Thread in which there will be Sleep (specify the time) and an Event call from the class instance, the main form will subscribe to these Events and their processing will be in the interface thread.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question