473,395 Members | 1,456 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,395 software developers and data experts.

Loop Kills Application?

Do until bStop = False
'there's some code here
'etc, etc
Loop
'some more code here

And then, I have a button that sets bStop = False when clicked: the program
blows up, fatal exception. What the...?

// fark0

Jun 24 '07 #1
4 1158

"Jason Molt" <dr******@gmail.comwrote in message
news:ex**************@TK2MSFTNGP02.phx.gbl...
Do until bStop = False
'there's some code here
'etc, etc
Loop
'some more code here

And then, I have a button that sets bStop = False when clicked: the
program
blows up, fatal exception. What the...?

// fark0
Is there a DoEvents or equivalent instruction for easing the breakage of
loops? Also, if you substitute While Wend for your Do Until Loop can you
achieve the same result with your code???

TIA

--
Timothy Casey GPEMC! >11950 is the nu****@fieldcraft.com.au 2email
Terms & conditions apply. See www.fieldcraft.biz/GPEMC
Discover valid interoperable web menus, IE security, TSR Control,
& the most advanced speed reading application @ www.fieldcraft.biz
Jun 24 '07 #2

"Jason Molt" <dr******@gmail.comwrote in message
news:ex**************@TK2MSFTNGP02.phx.gbl...
Do until bStop = False
'there's some code here
'etc, etc
Loop
'some more code here

And then, I have a button that sets bStop = False when clicked: the
program blows up, fatal exception. What the...?

Fatal exception as far as what? What is the rest of the error message?
Jun 24 '07 #3
Jason,

Does it blow up or just stop?

Cor

"Jason Molt" <dr******@gmail.comschreef in bericht
news:ex**************@TK2MSFTNGP02.phx.gbl...
Do until bStop = False
'there's some code here
'etc, etc
Loop
'some more code here

And then, I have a button that sets bStop = False when clicked: the
program blows up, fatal exception. What the...?

// fark0

Jun 24 '07 #4
well this runs as expected

Dim bstop As Boolean = True
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim icount As Integer
Do Until bstop = False
'there's some code here
'etc, etc
Debug.WriteLine(icount.ToString)
Application.DoEvents()
icount += 1
Loop
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
bstop = False
End Sub
so the problem is probably in the part where there is some code :-)

you need doevents in this case to let the thread check the state of the
boolean
otherwise you would have an endless loop wich might also depending on the
code that is in the loop result in out of memory ( out of stack ) exceptions
or other unpredictable results :-)

regards
"Jason Molt" wrote:
Do until bStop = False
'there's some code here
'etc, etc
Loop
'some more code here

And then, I have a button that sets bStop = False when clicked: the program
blows up, fatal exception. What the...?

// fark0

Jun 25 '07 #5

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

Similar topics

0
by: Karl Witmann | last post by:
Anyone have experience with httplib getting stuck reading the first line of a file? Most urls work fine (of course), but I tried the following: http://216.117.129.109/robots.txt Both Firefox...
0
by: Scott Carter | last post by:
I've got an app that contains a couple of Crystal Reports. The reports are working, but everytime I execute the code to show the reports in the debugger it kills VS.Net 2003. As it's dying, there's...
2
by: kaeli | last post by:
Okay, trying to get the for...in loop syntax and obviously doing something wrong. I have a form and a select with options. The explicit indexing I usually use works fine and alerts all the...
2
by: Jeff Thies | last post by:
I have a script with a regex var re = /\/(\w+?)\//; In IE5 Mac, that kills all javascript, anywhere on the page. No errors but no functionality at all. Just the mere presence of that line...
11
by: Lloyd Sheen | last post by:
Never mind what they tell you. Just installed 2.0 beta and no more 1.1. Tried to run simple ASP app and doesn't work anymore. Ran aspnet_regiss -i but to no avail. So anyone who tells you they...
1
by: Support | last post by:
Hello: I have an application that I wish to update upon login via login script but since the application is in the start-up menu, I cannot override the exe, so, I wrote a function that iterates...
8
by: Dave | last post by:
I am trying to write an event-driven application with no main window that runs "forever". It waits on a named event and then displays a window depending on data pased in a memory-mapped file. I...
5
by: Anshu | last post by:
int a; for(int i=0;;i++) {cin>>a; if(a==0) break; for(int j=0;j<i;j++) //NEW SORT MECHANISM if(a<a) {int t=a;a=a;a=t;} }
3
by: Damo | last post by:
Hi, I want to create variables in a loop, each with a different name. Here is the loop i'm using: if (is_array($attribs)) { echo "Attributes : <br />"; while(list($key,$val) =...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.