Windows Develop Bookmark and Share   
 index > Windows Forms Designer > forms closing event firing twice
 

forms closing event firing twice

I have this code on frmA
With frmB
.PreviousLotExists = Not AtStart
.NextLotExists = Not AtEnd
.ShowDialog()
End With

When frmB loads I click the cross to close the form and on that form I have a check to say are you sure (if user has typed into frmB) - this code runs twice.

When I click the cross on frmB how do I get the code to just fire once so that the event cancels - it runs the frmB_closing event twice even when I set Cancel = true

Gregor Suttie  Friday, July 10, 2009 8:35 AM
may be the form_closing method binded with the FormClosing event twice..

Check this binding..

this.FormClosing += new FormClosingEventHandler(Form1_FormClosing);


:: Learning .Net ::
Prasant Swain  Friday, July 10, 2009 2:35 PM
may be the form_closing method binded with the FormClosing event twice..

Check this binding..

this.FormClosing += new FormClosingEventHandler(Form1_FormClosing);


:: Learning .Net ::
Prasant Swain  Friday, July 10, 2009 2:35 PM

You can use google to search for other answers

Custom Search

More Threads

• Set collection item value through PropertyDescriptor?
• The Undo/Redo not working properly
• Drawing a textbox/combo
• Customize Property Grid Appearance
• Enter/Leave events on a panel
• accessing items in a listbox by double-clicking them
• How to change button image on Mouse enter, MouseLeave and Click?
• Textbox and margin
• Cannot inherit form from inherited form
• ToolStripContainer bug?