winforms - C# While loop until button click -
i making program in winforms (c#) in ms visual studio 2012
i need code this
code code code event button click user //start while loop.. { code code code code code code } (!button not click again)
i know many talk multithreading think low level work now, if can avoid will.
edit: ended using multithreading, answers helped me lot, @ time multithreading hard understand.
you should pushing work background thread. reason because main ui thread being stopped during while
loop means button won't accessible turn off. (i know said want avoid multiple threads reality you'll need use them in case).
the easiest way use backgroundworker. handle lot of thread spawning side of things you. can perform while
loop in dowork
event handler of background worker. free ui thread means button clickable @ point can set flag stop loop.
Comments
Post a Comment