title: Unregister combobox SelectedIndexChanged event before AddIn shutdown
body: <p>I am developing a MS Word 2010 AddIn, in which I have a combobox which updates a class property when it is changed:</p>
  
  <pre><code>private void comboboxFloweringStart_SelectedIndexChanged(object sender, EventArgs e)
  {
      Globals.ThisAddIn.currentTaxon.FloweringStart = (short)this.comboboxFloweringStart.SelectedIndex;
  }
  </code></pre>
  
  <p>This class is serialized on shutdown (<code>ThisAddIn_Shutdown</code> event handler). The combobox is located on <code>Microsoft.Office.Tools.CustomTaskPane taxonMarkupPanel</code> based on the user control <code>TaxonPanel myTaxonPanel</code> which I designed.</p>
  
  <p>The problem is that at some point before the shutdown event fires, the <code>SelectedIndexChanged</code> event on the combobox fires and resets the value to 0, and this is the value that is serialized. I know that I could use <code>SelectionChangeCommitted</code> instead of <code>SelectedIndexChanged</code>, but I do at times set the index in code, and the event should fire in these cases too.</p>
  
  <p>The CustomTaskPane does not have a close event that I could use to unsubscribe the event handler and I don't know the order of events when a VSTO is closed. Is there some other event I could subscribe to, or some other way that I can unsubscribe the <code>SelectedIndexChanged</code> event handler when the custom task pane / user control is closed?</p>