Found the following interesting discussion in the Newsgroups:
| when to use DoEvents in vb.net? by:Rich | |
| As I migrate my VB6 apps to vb.net I am checking what features I need to retain from vb6. In vb6 I noticed that DoEvents really made a performance difference when I called it just before a Do/For loop for large datasets. I hope do some multithreading in vb.net for this. But I am not completely sure about how System.Windows.Forms.Application.DoEvents() works, or its application/purpose. Is this the same as the DoEvents from vb6? Should I keep this feature in my vb.net projects? TIA, Rich | |
| Reply: by:Alex Papadimoulis | |
| I can't say it any better than the documentation ;-) events. For example, if you have a form that adds data to a ListBox and add DoEvents to your code, your form repaints when another window is dragged over it. If you remove DoEvents from your code, your form will not repaint until the click event handler of the button is finished executing. So the answer is, it depends. Do you want messages to be processed (such as redrawing)? Or do you want to go for maximum performance and not do it? -- Alex Papadimoulis | |
| Reply: by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP]) | |
There is no 'DoEvents' necessary if you put the dataset processing stuff into a separate thread. -- Herfried K. Wagner [MVP] | |
| Reply: by:Rich | |
| Thanks all for your replies. It sounds like System.Windows.Forms.Application.DoEvents() is the same as DoEvents from vb6. Just wanted to make sure. | |
Posted by Xander Zelders

1 Comments:
Putting the dataset processing in another thread would prevent the main thread from freezing until the process is done. But you have to realize with large processes the thread will run your cpu at 100% until done, without doevents.
Post a Comment
<< Home