Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How To: Auto Dispose a Custom Control?
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
How To: Auto Dispose a Custom Control?
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01198325
Message ID:
01198325
Views:
68
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
Next
Reply
Map
View

Click here to load this message in the networking platform