I have a function called Export Excel which basically exports data to excel and saves it. So i need to show a splash screen till my function completes the job. How can i do this.
EDITED : How to close my Please wait screen before showing the below dialog box
My code snippet:
//For back ground worker:
public Form1()
{
InitializeComponent();
backgroundWorker1.WorkerReportsProgress = true;
backgroundWorker1.WorkerSupportsCancellation = true;
_f2 = new Form2();
}
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
BackgroundWorker worker = sender as BackgroundWorker;
//backgroundWorker1.DoWork += new DoWorkEventHandler(this.ExportInExcel);
}
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
_f2.Hide();
}
private void button1_Click(object sender, EventArgs e)
{
_f2.Show();
backgroundWorker1.RunWorkerAsync();
ExportInExcel(lstExcel, @"Z:\Desktop\myExcel.xls"); // i need to show the splash screen and
//at the same time i need to do the function .. and close the splash screen after it
//completes the job.
}
private void ExportInExcel(SortedDictionary<string, ExcelData> lstData, string excelPath)
{
//some codes for precessing the file to excel
xlApp.Quit();
//xlApp.Close(false);
//xlApp.Quit();
Process[] pro = Process.GetProcessesByName("excel");
pro[0].Kill();
pro[0].WaitForExit();
releaseObject(xlWorkSheet);
releaseObject(xlWorkBook);
releaseObject(xlApp);
}