private void ToExcelButton_Click(object sender, EventArgs e) { if (ClientsPaymentsDataGrid.ColumnCount != 0) { Thread T = new Thread(delegate() { SplashWindow.CreateSmallSplash(ref TopForm, "Создание документа Excel.\r\nПодождите..."); }); T.Start(); while (!SplashWindow.bSmallCreated) { ClientPayments.ExportToExcel(); } while (SplashWindow.bSmallCreated) { SmallWaitForm.CloseS = true; } } }