I created a custom control in my application which accesses a global collection of DataSets, adding a private DataSet for the control. WHen the form that houses the control closes, I want the control to then remove the private DataSet it created in the global collection. I used "Implements IDisposable" in my custom control, but when the form closes the control's Dispose method does not run. It does run however, when I terminate the entire application, I assume because the Garbage Collector at this point realizes that nothing is referencing the object in memory any longer.
How di I get the dispose method of the control I created to run automatically when it's parent container form closes? I want to avoid calling .Dispose manually because then whoever uses this control has to remember to manyally dispose the control each time it's used, otherwise there will be memory left in use for datasets that are no longer needed.
Help! :-)
________________________
Ben Santiago, MCP & A+
Programmer Analyst (SQL, FoxPro, VB, VB.Net, Java, HTML, ASP, JSP, VBS)
Eastern Suffolk BOCES - Student Data Services
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
-Rich Cook