[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1007
  • Last Modified:

UserControl in vb.net

I have to clear some files on the unloading of my project.  I am using Windows Application (Not Web Application)
I have a usercontrol in my project. Before unloading the control i want to call my procedure which will delete some temp files which i have created.
What's the appropriate event in this case to be used. I don't have Unload event of usercontrol in windows application project.

Thanks for the help

  • 2
1 Solution
Why on unloading the usercontrol, why not using the closing event of your mainform
snomiAuthor Commented:
i have already done that, i was only wondering that how can i find the unload event for the usercontrol or any other avaiable event in its place.
Hi snomi,

if I understand you correctly, you are looking for a method/function/event in your user control, to use to perform 'cleanup' operations.

The recommended way to do this is to implement the Dispose() method in your usercontrol.

In the Dispose() method, clean up and release any resource your control is holding on to.

When you want to destroy the control from a client form and ensure it cleans up after itself, call the Dispose method.

Let me know if you need further info.


snomiAuthor Commented:
Hi David,

Thanks for very good reply. I also want to thanks the other people who have helped me in this problem

Take Care


Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now