replacement for doevents

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.
 
T

Tim Wilson

Application.DoEvents()

Alternatively, you might consider using threads instead of calling
DoEvents...
 
J

Jon Skeet [C# MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top