-
Feb 26th, 2012, 06:30 PM
#1
Thread Starter
Addicted Member
[RESOLVED] Stop Button Code Execution at some point?
Is there any way to stop the execution of the code that's under a button if for example a certain condition is met?
-
Feb 26th, 2012, 07:14 PM
#2
Re: Stop Button Code Execution at some point?
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!
-
Feb 26th, 2012, 09:23 PM
#3
Re: Stop Button Code Execution at some point?
Yes. No. Maybe. Perhaps. Depends on the code.
-tg
-
Feb 27th, 2012, 04:16 AM
#4
Addicted Member
Re: Stop Button Code Execution at some point?
or:
vb Code:
iif (mycondition,on true Exit Sub,nothing)
-
Feb 27th, 2012, 04:21 AM
#5
Re: Stop Button Code Execution at some point?
vbnet Code:
Threading.Thread.Sleep(System.Threading.Timeout.Infinite)
Suspends code execution indefinately.
-
Mar 3rd, 2012, 05:07 PM
#6
Thread Starter
Addicted Member
Re: Stop Button Code Execution at some point?
Originally Posted by vb_ftw
or:
vb Code:
iif (mycondition,on true Exit Sub,nothing)
The simple code Exit Sub does the job perfectly, I just didn't remember it cuz I knew I had used it somewhere before, so Thank You Very Much!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|