0
I’m using Winform and trying to save a string with Savefiledialog but I can’t pass the chosen directory in Savefiledialog to the System.IO File function.Writealllines;
private void saveCategoriesToolStripMenuItem_Click(object sender, EventArgs e)
{
string[] SaveString = new string[100];
SaveFileDialog SFD = new SaveFileDialog();
SFD.Filter = "Categories Files (.ctg)|*.ctg";
SFD.Title = "Save a Categories file";
SFD.ShowDialog();
if (SFD.FileName == "")
{
MessageBox.Show("Enter a name for the file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
SaveString[0] = tamanho.ToString();
for(int i=1;i<=tamanho;i++)
{
SaveString[i] = "\"" + KeysValues[i] + "\",\"" + CategoriesValues[i] + "\"";
}
SFD.DefaultExt = ".ctg";
System.IO.File.WriteAllLines(, SaveString);
}