You can try to avoid DoEvents and use ListView.Refresh.
Or use a separate thread if you want to handle events to cancel, etc. See
the 3 articles of the series:
Safe, Simple Multithreading in Windows Forms
http://msdn.microsoft.com/library/de...ms01232003.asp
Also, you can check if the listview is still there with the IsDisposed
property of all windows controls.
--
Best regards,
Carlos J. Quintero
MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
<p1*******@yahoo.com> escribió en el mensaje
news:11**********************@f14g2000cwb.googlegr oups.com...
Basically I need to populate a form's listview with entries from a DB
table, the form is called by the main form. All these is fine.
However, the population may take a long time due to the size of the
table, so I chucked in the DoEvents method in the loop to allow screen
repaint and such.
The problem comes when the user decided to close the form instead of
waiting, that's when the "Cannot Access A Disposed Object" exception
pops up. I understand the reason behind is that the listview is not
longer there. Is there a way to handle this?