-2

I have a .Net application with multiple forms invoked using form.ShowDialog(). When I do Application.Exit, the application is not closing all the forms.

When I try to do an explicit Form.Close I am getting an error from WinForms as below

at Microsoft.AGL.Common.MISC.HandleAr(PAL_ERROR ar) at System.Windows.Forms.Form._CloseModal() at System.Windows.Forms.Form.Close() at

Dave Zych
  • 21,581
  • 7
  • 51
  • 66

1 Answers1

0

As @CharithJ states in this answer (paraphrased):

Cancel the background worker and send an argument to the BackgroundWorker RunWorkerCompleted event to identify that time has expired. From that event you can call Application.Exit() just fine.

Community
  • 1
  • 1
gnarlybracket
  • 1,691
  • 4
  • 18
  • 37