This example shows how to close the Wait Form to cancel a time-consuming operation:
-
Add a
GridControlonto the Form. -
Place a
BackgroundWorkercomponent onto the Form and handle itsRunWorkerCompletedandDoWorkevents. -
Place a
SplashScreenManagercomponent onto the Form. -
Invoke the SplashScreen Manager's smart tag menu and add a Wait Form.
-
Add a Load Data button onto the Form and handle its
Clickevent to load data and display a wait form.private void simpleButton1_Click(object sender, EventArgs e) { Person.counter = 0; backgroundWorker1.RunWorkerAsync(locker1); splashScreenManager1.ShowWaitForm(); splashScreenManager1.SendCommand(WaitForm1.WaitFormCommand.SendObject, locker1); }
-
Open the WaitForm designer and add a Cancel button.
-
Handle the Cancel button's
Clickevent to cancel the operation:private void simpleButton1_Click(object sender, EventArgs e) { if (locker != null) ((ILocked)locker).IsCanceled = true; }
- WaitForm1.cs (VB: WaitForm1.vb)
- Form1.cs (VB: Form1.vb)
- ILocked.cs (VB: ILocked.vb)
- Locker.cs (VB: Locker.vb)
(you will be redirected to DevExpress.com to submit your response)