save file dialog help

Oct 6 2013 9:51 AM
Greetings Friends,

I have a problem while saving a batch file.
In my program i have a button, when button clicks it need to save the file with extension .bat. I defined it as " SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            saveFileDialog1.InitialDirectory = @"C:\";
            saveFileDialog1.Title = "";
            saveFileDialog1.CheckFileExists = true;
            saveFileDialog1.CheckPathExists = true;
            saveFileDialog1.DefaultExt = "bat";
            saveFileDialog1.Filter = "Batch Files (*.bat)|*.bat"|All files (*.*)|*.*;
            saveFileDialog1.FilterIndex = 2;
            saveFileDialog1.RestoreDirectory = true;

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
              textBox1.Text = saveFileDialog1.FileName;
            } "
The dialog box appears but the file is not saving.
please help me.

Answers (1)