Interrupting a data load

  • Thread starter Thread starter Frank
  • Start date Start date
F

Frank

I have made an application that loads data through an
OleDbDatareader. I would like the user to be able to
interupt the load.

Now, I could of course include an interrupt button in the
form. However, once the load starts program excution will
be in the object of my dataload class. And so I suspect
that the users interaction with an interrupt button
(which could set a flag in the load object) will not be
handled.

Instead of a lot of experimenting, I thought that I would
ask for some hints, from those who might already know how
to do this.


Regards,

Frank
 
Hi Frank,

Sorry, I'm busy on another query and then off to bed, so ...

The quick answer (ie. not telling you exactly how) is to spin off a Thread
to do the load. If the User hits that [Interrupt] button, then abort the
Thread.

You'll have to have a Try .. Catch ex As ThreadAbortException so that your
app doesn't fall over.

Regards,
Fergus
 
* "Frank said:
I have made an application that loads data through an
OleDbDatareader. I would like the user to be able to
interupt the load.

Now, I could of course include an interrupt button in the
form. However, once the load starts program excution will
be in the object of my dataload class. And so I suspect
that the users interaction with an interrupt button
(which could set a flag in the load object) will not be
handled.

Instead of a lot of experimenting, I thought that I would
ask for some hints, from those who might already know how
to do this.

I think you got very good answers in your previous thread.
 
Hi Fergus,

Thanks, I'll work out how. Just needed to know, if
threading was neccesary or there was another way. I'll
read up on handling threads and then get to it.

Regards,

Frank

-----Original Message-----
Hi Frank,

Sorry, I'm busy on another query and then off to bed, so ...

The quick answer (ie. not telling you exactly how) is to spin off a Thread
to do the load. If the User hits that [Interrupt] button, then abort the
Thread.

You'll have to have a Try .. Catch ex As
ThreadAbortException so that your
 
In general I don't like the idea of Aborting a thread too much - it would be
much better to stick a flag in the thread main loop to terminate cleanly.
 
Back
Top