title: Call System.IDisposable.Dispose on object 'emailForm' before all references to it are out of scope
body: <p>I have the following function:</p>
  
  <pre><code>    private void emailVideoButton_Click(object sender, EventArgs e)
      {
          VideoEMailForm emailForm = new VideoEMailForm();
          emailForm.ShowDialog();
      }
  </code></pre>
  
  <p>Which gives me the following warning:</p>
  
  <blockquote>
    <p>Warning   1   CA2000 : Microsoft.Reliability : In method
    'VideoPlayerControl.emailVideoButton_Click(object, EventArgs)', call
    System.IDisposable.Dispose on object 'emailForm' before all references
    to it are out of scope.</p>
  </blockquote>
  
  <p>I read this link <a href="http://msdn.microsoft.com/en-us/library/ms182289(v=vs.80).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms182289(v=vs.80).aspx</a> and gathered that I needed to call .Dispose like so:</p>
  
  <pre><code>    private void emailVideoButton_Click(object sender, EventArgs e)
      {
          VideoEMailForm emailForm = new VideoEMailForm();
          emailForm.ShowDialog();
          emailForm.Dispose();
      }
  </code></pre>
  
  <p>But then I get the following warning:</p>
  
  <blockquote>
    <p>Warning   1   CA2000 : Microsoft.Reliability : In method
    'VideoPlayerControl.emailVideoButton_Click(object, EventArgs)', object
    'emailForm' is not disposed along all exception paths. Call
    System.IDisposable.Dispose on object 'emailForm' before all references
    to it are out of scope.</p>
  </blockquote>
  
  <p>Can anyone help me to get rid of this warning?</p>