By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,234 Members | 1,877 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,234 IT Pros & Developers. It's quick & easy.

Application can't be interrupted when running in a loop

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
* "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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.