protected void ClearPanel() { if (panel1.InvokeRequired) { ClearPanelCallback d = new ClearPanelCallback(ClearPanel); panel1.BeginInvoke(d, new object[] { }); } else { panel1.Controls.Clear(); } }