this is the close method i have within the usercontrol public void CloseAllActions() { if (MyConnection.isConnected) { this.Client.Abort(); Client.Join(); this.ServerDetails.Abort(); ServerDetails.Join(); MyConnection.CloseConnection(); } } from the main from this is what i have to run that method within that usercontrol private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (MYControl!= null) { e.Cancel = true; MYControl.CloseAllActions(); MYControl.Dispose(); tab.Dispose(); Thread.Sleep(200); this.Dispose(); } else { e.Cancel = false; // this.Dispose(); } }
ServerDetails.Join()
ServerDetails
Sleep(200)
Closing
if (MYControl != null) { e.Cancel = true; foreach (TabPage tab in this.tabControl1.TabPages) { foreach (MYControl MYTabControl in tab.Controls) { MYTabControl.CloseAllActions(); } } this.Dispose(); } else { e.Cancel = false; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)