New Posts New Posts RSS Feed: CancelAsync
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

CancelAsync

 Post Reply Post Reply
Author
-ook View Drop Down
Groupie
Groupie
Avatar

Joined: 26-Aug-2007
Location: Australia
Posts: 41
Post Options Post Options   Quote -ook Quote  Post ReplyReply Direct Link To This Post Topic: CancelAsync
    Posted: 26-Sep-2007 at 11:20pm
I have a form that is constantly using an asynchronous query. It works well (most of the time, but that is a separate issue).

When I close my windows form, I issue a CancelAsync command, this also works.... most of the time. Occasionally I get an error when the form is closed, I can replicate this error by commenting out the CancelAsync line in the FormClosing event. Therefore I can safely conclude that the CancelAsync command occasionally  does not 'take'. The documentation mentions a race condition may sometimes occur, I believe this is the case.

My question therefore is, what is the recommended solution for ensuring an async command is cancel when called from a FormClosing event?

Thanks
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down