473,480 Members | 1,964 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Application can't be interrupted when running in a loop

Rvo
I have written an application that manipulates files, while doing so the
program is running in a loop and any actions on the GUI will not get any
response. When I try to stop the processing of the files trough the GUI by
clicking on a button this will not be done.

The action connected to the stop-button is to set a boolean to "true"
in the loop which processes the files I check contiuously for the boolean
becomming true and if so exit the loop.
But this condition is never set to true.

Is there a way to write code that still accepts user input while running in
a loop?

Kind regards,

Romain Voes
Nov 20 '05 #1
2 1174
* "Rvo" <romainvoes@{DoesNotLikeSpam}vlaamsparlement.be> scripsit:
I have written an application that manipulates files, while doing so the
program is running in a loop and any actions on the GUI will not get any
response. When I try to stop the processing of the files trough the GUI by
clicking on a button this will not be done.

The action connected to the stop-button is to set a boolean to "true"
in the loop which processes the files I check contiuously for the boolean
becomming true and if so exit the loop.
But this condition is never set to true.


I would use multithreading to do that. You can find a sample here:

<URL:http://dotnet.mvps.org/dotnet/samples/filesystem/downloads/FileSystemEnumerator.zip>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #2
Rvo
Dear Herfried,

It works just fine. Thanks.

Romain

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schreef in bericht
news:uI**************@TK2MSFTNGP10.phx.gbl...
* "Rvo" <romainvoes@{DoesNotLikeSpam}vlaamsparlement.be> scripsit:
I have written an application that manipulates files, while doing so the
program is running in a loop and any actions on the GUI will not get any
response. When I try to stop the processing of the files trough the GUI by clicking on a button this will not be done.

The action connected to the stop-button is to set a boolean to "true"
in the loop which processes the files I check contiuously for the boolean becomming true and if so exit the loop.
But this condition is never set to true.
I would use multithreading to do that. You can find a sample here:

<URL:http://dotnet.mvps.org/dotnet/sample...s/FileSystemEn
umerator.zip>
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 20 '05 #3

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

Similar topics

6
20033
by: orekin | last post by:
Hi There I have been trying to come to grips with Application.Run(), Application.Exit() and the Message Pump and I would really appreciate some feedback on the following questions .. There are...
2
2718
by: Uchiha Jax | last post by:
Hi, Recently had an issue with the Audio object from Microsoft.DirectX.AudioVideoPlayback. None of the events were firing from the object during tests (NUnit or Console). Knowing I had it...
9
6856
by: John Williams | last post by:
How do I load a HTML page (via URL) and parse the DOM in a Console Application? I've successfully done all this in a Windows Application by using the WebBrowser control, calling the Navigate...
4
2103
by: Tad Marshall | last post by:
Hi, I'm having limited luck getting an ApplicationException to work right in my code. This is VB.NET, VS 2003, Windows XP SP2, .NET Framework 1.1. I thought it would be convenient to take...
0
4184
by: Ralf Gedrat | last post by:
Hello! I have a Application, this throws after some time following exception: Item has already been added. Key in dictionary: "- 1" key being added: "- 1" I use Application.Run with...
8
2131
by: Bryan | last post by:
Does anyone have an example of an application that can connect to a running process and capture Trace.WriteLine calls like in SQL Server Profiler? I know that we can inherit from a TraceListener...
16
12839
by: Alan T | last post by:
I tried to use a thread to process a iterative execution of processes but afraid my thread is not thread-safe. If I am not using a thread, my main form will become 'white' when switch forth and...
4
2237
by: rob | last post by:
I'm running PHP 5.2.3 via fastcgi. When I upload one file via a form, it works perfectly. When I try to upload two files, however, I get the 'Connection Interrupted / The network link was...
1
20535
by: Ryan Liu | last post by:
Hi, I have a 100 clients/ one server application, use ugly one thread pre client approach. And both side user sync I/O. I frequently see the error on server side(client side code is same, but...
0
7052
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
7092
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...
1
6744
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
6981
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...
0
5348
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,...
1
4790
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
4488
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...
0
3000
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
565
muto222
php
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.