Popular Articles
Last viewed:
- Performance benchmarks for LINQ vs. SqlDataReader, DataSet - Selects: Part 1
- Global.asax Events in IIS 6 and IIS 7 for Static Resources
- Performance benchmarks for LINQ vs. SqlDataReader, DataSet - LINQ Compiled Queries: Part 2
- Create trigger MySQL 5.0 - super privilege required
- Fixing Relative Paths in C# ASP.NET When Using Url Rewriting
- C# Free Component to Generate PDF - Convert HTML to PDF
Recent comments
- Awsome!!
7 hours 26 min ago - C# insert image
22 hours 19 min ago - jkll
3 days 10 hours ago - Thank You
4 days 10 hours ago - Another approach
6 days 11 hours ago - Issue
1 week 46 min ago - thanks
1 week 11 hours ago - Calendar date time
1 week 17 hours ago - Nice Explanation
1 week 21 hours ago - ramya
1 week 3 days ago

cancellation
this is a little late, but here's my two cents!
you need to set the 'WorkerSupportsCancellation' property of the background worker to true, then implement some sort of button that will call the 'CancelAsync' method of the background worker, this sets the 'CancellationPending' property of the background worker to true. you then need to implement some sort of check to catch the change (if statements work well) and cancel the background worker there using the event arguments (in most cases, e.cancel works. remember to close any streams you have open! i think, but i'm not 100% sure, that if you implement the check inside a while loop you also need a break statement)
hope that helps! might be an easier way of doing it, but this works well for me. only been using c# for a few months, be happy to hear any better ways if there are any!
cracking article btw, i adapted this code for an ftp uploader and it worked a treat!