I have 1 form and datagridview in it. When I click update button,new forms open with progressbar only. In that form I have 2 functions. 1 for connecting email and downloading excel file. The other for reading excel file and updating my database. It is working fine. Now , I want that when I close the progress bar form , it should be cancelled. I tried backgroundworker and creating thread but I couldn't make them work for my purpose. Can anyone help me?
Asked
Active
Viewed 89 times
1 Answers
0
How about using a cancellation token in a task? https://msdn.microsoft.com/en-us/library/dd997396%28v=vs.110%29.aspx

user1156000
- 96
- 1
- 14
-
I searched a little and as I understand for cancelling with this or other ways , I need a loop and everytime I should check if canceling is requested or not. But in my program I dont have loop. It connects, downloads,reads and updates. – inanc Feb 05 '15 at 13:41