I am working on a form in this form when the user clicks the create new stream button, which created a new form and did a certain job and showed the result. See the following code. I made a main class in my project that stores links of each type of object.
Program.someFormReference
When the user clicks the button, a new thread is created and Program.someFormReference = new CreatedForm (). Now, what happens if the user clicks the button more than once. We have several objects in memory with threads running on them. But I had a link to only one thread. One way to avoid this situation is to disable the button until the thread completes its execution. Another solution may be to avoid this uncontrolled chain of threads.
source
share