void _BotCycle_Finishing(int id) { lock (this) { BotThreadItem bti = null; BotThreadControl btc = null; foreach (BotThreadItem i in listBotThreads.Items) { btc = i.BTC; if (btc.Id == id) { bti = i; break; } } if (bti == null) { return; } id2bot_thread_control.Remove(btc.Id); listBotThreads.Items.Remove(bti); this.groupBoxBotThread.Controls.Remove(btc); btc.Dispose(); MainForm.This.DisplayStatus2("Thread Count", Convert.ToString(listBotThreads.Items.Count)); } }