Best place to put clean up code on exit

I've got some code to clean up a few things when exiting my program. I inserted the sub routine's name into the Form's Unload event. It worked initially in the testing stages but doesn't seem to be working when the actual program has been running for a while. I normally close the program out using the close (X) button in the upper right. I'm wondering if there's a better place to stick the exit code, or if it's just a matter of narrowing down what's causing it not to run. Thanks.
Who is Participating?
I would put a break point on the sub routine call in the Unload event. Then when it hits that point,hit F8 to step through one line at a time. That should allow you to see what is happening.
JohnDoeSrAuthor Commented:
Yep that helped to find it. Thanks again!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.