I have a C# windows form Menu based application in .Net framework 4.0. in my option there are too many controls are added in form. a DataGridView is my first control on form. I handled a event on DataGridViewCellDoubleClick
, in this event I am set values of all controls, and too many events are fire from this event and too many method is also called from this event.
My question is i double click on DataGridViewCell
then immediately i click on my form exit button. my form is immediately close but my CellDoubleClick
event is fired and it is executing and i have too many problems and exceptions occur because form is closed but my code is executing.
How can I resolve this problem that either form not close when my event is completely execute, or my event is should not execute or i can do some code in Closing event of form that prevent me from this problem.