0
SaveFileDialog sfd = new SaveFileDialog();

sfd.ShowDialog();
sfd.Filter("Wave Files|*.wav");
ss.SetOutPutToWaveFile(sfd.FileName);
ss.Speak(richTextbox.Text);
ss.SetOutputToDefaultAudioDevice();
Dmitry
  • 13,797
  • 6
  • 32
  • 48
kch4416
  • 31
  • 2

2 Answers2

3
if (sfd.ShowDialog() == DialogResult.OK){

  //user  saved it
}
else {

   //write code to handle the case when an user does't save , and canceled it
}
Viva
  • 1,983
  • 5
  • 26
  • 38
  • do not use sfd.ShowDialog(); anymore. Erase this line . And use it like I have shown. – Viva Sep 04 '15 at 14:09
2

Use a return value from sfd.ShowDialog():

if (sfd.ShowDialog() == DialogResult.OK)
{
    // File was selected
}
else
{
    // Cancelled
}
Dmitry
  • 13,797
  • 6
  • 32
  • 48