473,789 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1176

"Jason Molt" <dr******@gmail .comwrote in message
news:ex******** ******@TK2MSFTN GP02.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****@fieldcra ft.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******** ******@TK2MSFTN GP02.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******** ******@TK2MSFTN GP02.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(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim icount As Integer
Do Until bstop = False
'there's some code here
'etc, etc
Debug.WriteLine (icount.ToStrin g)
Application.DoE vents()
icount += 1
Loop
End Sub
Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) 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
1089
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 and IE return: fopen: No such file or directory httpd: could not open document config file /etc/httpd/conf/httpd.conf A misconfigured server...
0
1377
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 a command window with something about a MiniDump and there are a couple of entries in my event log (see below). I'm working on XP Pro. Here are the event log messages: -------------------------------------------- Faulting application...
2
2069
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 values. The for...in loop gives undefined for both IE and NN, but for IE, kills it with way too many alerts. NN6 gives the right number of alerts (5 options, 5 alerts) but all say undefined. Anyone know what I did wrong? AFAIK, selectElement.options...
2
1092
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 without it being called. removing the "?", returns everything normal.
11
1168
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 run side by side needs to be put in the stocks with the spammers. No I can only hope that a system restore will fix this. Lloyd Sheen
1
1186
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 through all the instances of this application and kills the one instance that is not itself and then shuts itself down. The idea is that in a batch file , I could run <applicationname> shutdown which would create a new instance of the...
8
5269
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 started with a standard console application and it all works fine, except that it does not terminate tidily when the user logs off/shuts down. So, I figured I needed a message loop to pick up WM_QUIT. I studied the code in "Waiting in a message loop"...
5
2944
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
1510
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) = each($attribs)) { echo $key."has the value".$val."<br>";
0
9663
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9506
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10404
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10193
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10136
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9979
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9016
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
4089
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3695
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.