473,545 Members | 2,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cancelling process with Cancel event

VM
How can I cancel all running processes in my application when I click on the
Cancel button? When the Run button's clicked, it creates an instance of a
specified class and runs a method that reads each line of a file, processes
it , and writes it. With the Cancel button, I'd like to cancel this method.

Is this possible?

Thanks.
Nov 15 '05 #1
1 7335
TB

----- VM wrote: ----

How can I cancel all running processes in my application when I click on th
Cancel button? When the Run button's clicked, it creates an instance of
specified class and runs a method that reads each line of a file, processe
it , and writes it. With the Cancel button, I'd like to cancel this method

Is this possible

Yes, it's easy if you use a separate thread to perform the processing. For example, when the Run button is clicked you can start a new thread and that thread creates the instance of your specified class and proceeds to read the file and process it

In the meanwhile, your main thread can still respond to UI events and when the Cancel button is clicked you can either; 1) abort the worker thread you created before, or 2) set a flag that the worker thread examines that will indicate that it should abort its processing more gracefully

-- T
Nov 15 '05 #2

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

Similar topics

11
18329
by: ryanmhuc | last post by:
I have a function which needs to cancel the input into a text field on a form. I cancel the event in IE fine and the text does not get entered. But for firefox (1.0) I cancel the event and the text still gets entered. I've stripped the function down just to try to get it to work in Firefox. The alert does happen on the keydown event so it...
6
1989
by: downwitch | last post by:
OK, the last time didn't get an answer, let's see if I can explain it better. (Someone else here _must_ have done this at some point?) I have a progress-meter type thing set up to follow the compacting of a database, using Michael Kaplan's COM add-in. The plug-in exposes an event as the the "pieces" are completed; this event includes a...
1
8318
by: AP | last post by:
Hi, I'm trying to use c# to pop up a dialog box when a user attempts to close word to prompt them if they want to exit or cancel (obviously other stuff needs to happen based on their selection but that's the gist of it.) I have everything set up, and it seems to work except that setting Cancel to true and returning from my c# method appears...
1
3231
by: Joshua T. Moore | last post by:
If application A sends a Process.Close message to application B, is there an event handler in application B to handle it? The problem is that application A sends the close message to application B, but since B has modal dialogs up, it doesn't close. I don't want to send a Process.Kill because then the user would not have the option of saving...
2
2047
by: lgbjr | last post by:
Hi All, I see that this topic was discussed back on august 23rd, but I didn't see a real answer. I have a VB.NET MDI app. A particular menu action on the MDI parent is to call an OpenFileDialog box. If the result is ok, I show a form with related information about the file. However, there are only specific files allowed. In the MDI child...
1
3927
by: sck10 | last post by:
Hello, When using a FormView, DetailsView or GridView, how do you capture the cancel event when you are in the insert/update mode. I have a formview that I need to hide if the person clicks on the "cancel" link. Any help would be appreciated. -- Thanks in advance, sck10
5
3303
by: Diego | last post by:
How do I capture a cancel event of Printer dialog box? Regards, Diego
2
3040
by: =?Utf-8?B?TmVldGE=?= | last post by:
Hi, I creating a console application. In that I want to catch the cancel event of the console application .Please guide me in this.I figured out that I will have to attach event to the console.How can I do that? Please help ! Thanks,
7
4658
by: John Gault | last post by:
I experimented with a snippet of JavaScript that will display a "Please Wait" message and graphic while the results of a cgi script is running (the script grabs a bunch of data and formats it in a table). Once the page has loaded, the script clears the message and graphic. It works fine, however if you click the button on the browser to...
1
7437
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...
0
5982
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...
1
5343
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4958
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3465
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1900
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
1
1023
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
720
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.