开发者

mdi parent form_close event wouldn't trigger mid children form_close event?

开发者 https://www.devze.com 2022-12-15 08:12 出处:网络
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 tcp

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消