Threads Help
I have a form with a Search button, that switches into a Cancel button (just text changes and an IF/ELSE clause in the click effect)
So when I click Search, it changes into Cancel, i start a new thread that performs the loading of information from an SQL database into a DataSet, then i do some Invokes to set the datasource and the thread would end with my search results found.
The user could interrupt though by clicking the Cancel before the search is done and the thread is aborted, joined, and set to null.
The problem is, it works when i operate it normally, search and then cancel momentarily after, search and don't cancel it... but when i click it really fast, repeatedly, it messes up. The search continues and never stops, debug goes to the point of the SQL call (done thru a custom webservice) and the thread just seems to stop right there
any help would be appreciated. any thoughts? or further explanation?
|