Click here to Skip to main content
15,894,460 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello friends
i have to close connection to database on unload of the form ,but couldn't found that event . how should i do the same ?
because i have open the connection at form load same thing i have to do for close ...
please help !!
Posted

Look at the Form.FormClosing event[^] or override the Dispose method and do it there.

Personally, I would go for the FormClosing event because the Dispose call may not happen for hours or weeks after the form has been closed.
 
Share this answer
 
Hello Freind
You can use
FormClosed or FormClosing Event
I hope that help you
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900