Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WinForm And Looping

Tags:

c#

loops

winforms

I have a WinForm set up and a process that loops until a button is pressed on the form.

When I try to run my code, the form does not even display. I suspect this is because the code gets stuck in the loop and doesn't get far enough to display the WinForm. How can I get the form to display and the loop to run after that point?

like image 446
sooprise Avatar asked Feb 26 '23 23:02

sooprise


1 Answers

If you're looping because you need to do something with the GUI periodically while waiting for input, I suggest using a Timer control and its Tick event.

If you want to do non-GUI things while waiting, a more traditional timer is better suited to the task,

like image 136
Powerlord Avatar answered Mar 08 '23 02:03

Powerlord