Answer the question
In order to leave comments, you need to log in
How to remove WinForms hang during loop execution?
A simple application with one button. After the button is clicked, a method is called that runs the loop indefinitely. And during the execution of the cycle, the application can no longer be used, it freezes. But when the cycle ends, everything is fine.
How can this be fixed?
Answer the question
In order to leave comments, you need to log in
You need to use streams.
Loops, execution of other complex functions inside the gui thread causes the program to hang and crash due to the blocking of the main application thread, as a result of which the program cannot process other events.
Examples:
https://docs.microsoft.com/en-us/dotnet/api/system...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question