This example shows how to close the Wait Form to cancel a time-consuming operation:
-
Add a
GridControl
onto the Form. -
Place a
BackgroundWorker
component onto the Form and handle itsRunWorkerCompleted
andDoWork
events. -
Place a
SplashScreenManager
component 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
Click
event 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
Click
event 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)