Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 16th, 2012  |  syntax: None  |  size: 0.45 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Are events guaranteed to go off?
  2. public class SomeForm : Form
  3. {
  4.     private void SomeForm_FormClosed(object sender, FormClosedEventArgs e)
  5.     {
  6.         MessageBox.Show("FormClosed event in SomeForm class");
  7.     }
  8. }
  9.  
  10. public class Consumer
  11. {
  12.     SomeForm someForm = new SomeForm();
  13.     someForm = null; //Ideally the messagebox would display here
  14.     SomeForm someForm = new SomeForm();
  15.     someForm.Close();  //Messagebox would display in this case as well
  16. }