title: Stopping SoundPlayer playback
body: <p>I am trying to create my own little Soundboard for playing WAV files.  Now the playback isn't a problem, but I want a way to stop playback if required.  I thought of a stop button, but did not know how to make that work.  So I thought of using a loop but it doesn't seem to work.  Just wondering if anyone can help me where I am going wrong or if this is just a fail way to do it, then if you can show me a better way that would be great.  :)</p>
  
  <pre><code>    private void button1Sound(object sender, MouseEventArgs e)
      {
          int i = 0;
          SoundPlayer simpleSound = new SoundPlayer(@"file.wav");
  
          while (i == 0)
          {
              simpleSound.Play();
              i++;
          }
  
          if (i &gt;= 1)
          {
              simpleSound.Stop();
          }
      }
  </code></pre>
  
  <p>I also thought of just doing an ELSE IF but that also didn't work.  I tried:</p>
  
  <pre><code>    private void button1Sound(object sender, MouseEventArgs e)
      {
          int i = 0;
          SoundPlayer simpleSound = new SoundPlayer(@"file.wav");
  
          if (i == 0)
          {
              simpleSound.Play();
              i++;
          }
          else if (i &gt; 1)
          {
              simpleSound.Stop();
          }
      }
  </code></pre>