mdi parent form_close event wouldn't trigger mid children form_close event?
I am working on a c# project that has a mdi parent form hosting multiple mdi children form. In one of the children forms, I opened a socket and listening on the socket using tcpListner. I stop the tcpListner when user close that mdi childform. But when I close the mdi parent without close the mdi children开发者_开发技巧 form first, the tcpListner did not get stopped.
My question is: Do I have to manually call each mdi children's form_close event handler when I close Mdi-parent form? How to make sure a specific socket is closed or tcpListner is stopped?
Thanks
Perhaps you might try putting it into the form_closing event? It fires before the form_close event.
精彩评论