Is there any way to stop the execution of the code that's under a button if for example a certain condition is met?
Printable View
Is there any way to stop the execution of the code that's under a button if for example a certain condition is met?
Yes OP there are several ways/methods.
Here is a basic one, using Flag to halt a Loop.
vb Code:
Dim StoppingExecution as Boolean =False
Your Loop could be like this:
-vb Code:
Do until StoppingExecution ' code to execute in here Loop
Do { While | Until } condition
[ statements ]
[ Exit Do ]
[ statements ]
Loop
-
Good Luck!
Yes. No. Maybe. Perhaps. Depends on the code.
-tg
or:
vb Code:
iif (mycondition,on true Exit Sub,nothing)
Suspends code execution indefinately.vbnet Code:
Threading.Thread.Sleep(System.Threading.Timeout.Infinite)