Hi Cor,
Yes (but with the following very slight 'frills')
In the main app, start a thread to run the SQL command
Do a 'WaitOne' on a 'SQL thread finished' event with a timeout of three
seconds
If the event did not fire within the three seconds, display a modal dialog
with a 'clock' and a cancel button (I wait for up to three seconds before
doing this so that the, majority, of requests which take less than three
seconds do not have the overhead of creating the dialog and if any user
wants to cancel the SQL task within three seconds they should be shot for
being so impatient!)
The timer tick event first checks for the SQL thread having finished by
doing a very short 'WaitOne' on the event above and then either closes the
dialog with a me.Close if it has or updates a 'clock' label.
If the Cancel button is clicked, it cancels the SqlCommand and then does a
Thread.Join to wait for the DB thread finishing before doing a me.Close.
The main app which created modal dialog does a .Dispose on the dialog form
object when it returns to make sure that the timer is cleaned up.
Thanks again.
Stephen
"Cor Ligthert" <no************@planet.nl> wrote in message
news:OX**************@TK2MSFTNGP15.phx.gbl...
Stephen,
You mean that what you are doing is
Starting a modal form with a timer as a clock in it and a button
Start in that modal form a thread to read something
Abort that thread when the user pushes the button (when it is not ready)
Cor