Skip to content

How to save resource file to a drive.

Enos

Asked Feb 9, 2015, 1:30 AM ESTSolved
Share
LinkedInX
Hi,
 
Am trying to save resource file to any directory but it is throwing an error. It says, Verify that the correct file name was given.
 
here is my codding,
 
Java
string PathSelection = "";
                SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Title = "Save Resource Files";
                saveFileDialog1.Filter = "Save Resource Files (*.resx)|*.resx";
                saveFileDialog1.FilterIndex = 1;
                saveFileDialog1.RestoreDirectory = true;
                if (saveFileDialog1.ShowDialog() == DialogResult.OK) //it breaks on this line
                {
  string path = saveFileDialog1.FileName;
  //oDataSet.WriteXml(path);
}

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Pranay Rana
    ✓ Accepted answer0
    Its better you add more property with savedialog box to check that file already exist with same name and also path of saving file is exist or not and than try, also set intialdirectory where you want to save 

    so add property than try

      SaveFileDialog1.InitialDirectory = @"C:\";
      SaveFileDialog1.CheckFileExists = true;
      SaveFileDialog1.CheckPathExists = true;
    0
  • 1 short reply
    • 0
      Thanks, that works....
      0