I'm using WinForm and trying to save a string with SaveFileDialog but I can not pass the chosen directory in SaveFileDialog to the System.IO.File.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);
}