replacement for doevents

  • Thread starter Thread starter z f
  • Start date Start date
Z

z f

Hi,

i have vb.net windows forms applciation.
i make a loop in order to do some work that consumes time, and i want the
user to be able to press the stop button in the middle, problem is that no
events are received while in the loop.
in VB6 we had the DoEvents command that did the job.
what is the vb.net replacement for DoEvents?

TIA, z.
 
Application.DoEvents()

Alternatively, you might consider using threads instead of calling
DoEvents...
 
z f said:
i have vb.net windows forms applciation.
i make a loop in order to do some work that consumes time, and i want the
user to be able to press the stop button in the middle, problem is that no
events are received while in the loop.
in VB6 we had the DoEvents command that did the job.
what is the vb.net replacement for DoEvents?

DoEvents was basically a hack to simulate multithreading. In .NET
threading is there in all its glory - you should do anything time-
consuming on a non-UI thread.

See http://www.pobox.com/~skeet/csharp/threads for an introduction to
threads.
 
Back
Top