473,408 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

exception handing??


A subroutine is nested many levels deep in the call
stack, and is looping on a mathematical calculation. If
the user clicks a command button called cmdStop, you want
the loop to stop executing and return control to the top-
level procedure, just after the call to the next lower
level. How would i do that?
thanks all!!
Nov 20 '05 #1
7 1752
"sandy" <wa*******@yahoo.com> scripsit:
A subroutine is nested many levels deep in the call
stack, and is looping on a mathematical calculation. If
the user clicks a command button called cmdStop, you want
the loop to stop executing and return control to the top-
level procedure, just after the call to the next lower
level. How would i do that?
thanks all!!


You can set a boolean flag that is checked in the algorithm. If it is
set, you can execute a 'Return'.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
Hi Sandy,

You'll need a timer to be checking the boolean flag that Herfried mentioned.

HTH,

Bernie Yaeger

"sandy" <wa*******@yahoo.com> wrote in message
news:10****************************@phx.gbl...

A subroutine is nested many levels deep in the call
stack, and is looping on a mathematical calculation. If
the user clicks a command button called cmdStop, you want
the loop to stop executing and return control to the top-
level procedure, just after the call to the next lower
level. How would i do that?
thanks all!!

Nov 20 '05 #3
Cor
Sandy is it this what you are searching for?
In your procedure
\\\\
application.doevents
////
Cor
all!!
Nov 20 '05 #4
Hi Sandy,

Are you saying that you want the calculation to abort and jump all the way
out again without going back up through the call stack?** If so, you can
enclose the outermost call in a Try..Catch..End Try block and throw an
Exception in the deepest depths.

Regards,
Fergus

** Or at least without you having to add loads of code to guide it back out.
Nov 20 '05 #5
"Cor" <no*@non.com> scripsit:
Sandy is it this what you are searching for?
In your procedure
\\\\
application.doevents
////


This will allow user interaction...

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #6
Cor
Herfried
\\\\
application.doevents
////


This will allow user interaction...

Message from poster
A subroutine is nested many levels deep in the call
stack, and is looping on a mathematical calculation. If
the user clicks a command button called cmdStop, you want
the loop to stop executing and return control to the top-
level procedure, just after the call to the next lower
level. How would i do that?
thanks all!!

I thought, in every routine applications.doevents
application.doevents
if userhasstopped then exit routine.
I think this stops very fast.
But I can be wrong?
Cor
Nov 20 '05 #7
"Cor" <no*@non.com> scripsit:
Message from poster
A subroutine is nested many levels deep in the call
stack, and is looping on a mathematical calculation. If
the user clicks a command button called cmdStop, you want
the loop to stop executing and return control to the top-
level procedure, just after the call to the next lower
level. How would i do that?
thanks all!!

I thought, in every routine applications.doevents
application.doevents
if userhasstopped then exit routine.
I think this stops very fast.


If the application should allow user interaction, 'Application.DoEvents'
works. As an alternative you can do the calculation in a separate
thread which checks a flag that tells the algorithm to stop.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
by: garyolsen | last post by:
In C++ what kind of unexpected conditions should be handled as exceptions? Besides dividing by 0, bad memory allocation, what're the most popular exceptions? When should not use exception,...
44
by: craig | last post by:
I am wondering if there are some best practices for determining a strategy for using try/catch blocks within an application. My current thoughts are: 1. The code the initiates any high-level...
2
by: dan | last post by:
hi ng. i have a asp.net application which is client of an asp.net webservice. now i want to configure a custom error page (in case the sewrvice throws an exception) that provides the...
2
by: scorpion53061 | last post by:
This app I am working on generated an exception but I have only found it on his laptop. Other machines do not seem to have this issue. The exception is normally according to what I have seen...
6
by: Ant | last post by:
Hi, I'd like to catch a specific exception that is raised when an int is assigned a string. I can't force the exception to see what is thrown because it creates a compile time error when fed a...
1
by: JeffDotNet | last post by:
I have been enjoying the declarative use of the new sqlDataSource in asp2.0. It makes paging and query building extremely quick and simple. However occasionally I expect to get a timeout...
41
by: Stuart Golodetz | last post by:
Hi all, Just wondering whether there's any reason why exception specifications are enforced at runtime, rather than at compile-time like in Java? (This was prompted by reading an article on...
41
by: Zytan | last post by:
Ok something simple like int.Parse(string) can throw these exceptions: ArgumentNullException, FormatException, OverflowException I don't want my program to just crash on an exception, so I must...
12
by: EvilOldGit | last post by:
In Stroustrup he talks of a MathErr class that you can use to catch floating point exceptions. It doesn't exist, at least not in Visual C++ I can catch FP exceptions using catch(...) but am...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.