Save data in a temporary .csv file to another csv file

394 Views Asked by At

I have a problem. I have created a temporary .csv file, which contains a lot of data. The directory is a string: path = @"C:\Users\xxxxx\Documents\TempFile.csv";. I want to save this temporary file as a .csv file, when the user click on the save button. I have created a dialog, so the user is able to choose where to save the file.

private void SaveBT_Click_1(object sender, EventArgs e)
    {
        {
            SaveFileDialog saveDialog = new SaveFileDialog();

            saveDialog.Filter = "CSV File|*.csv";
            saveDialog.Title = "Gem en CSV fil";

            if (saveDialog.ShowDialog() == DialogResult.OK)
            {

            }
        }
    }
1

There are 1 best solutions below

0
On BEST ANSWER

erm, how about?

File.Copy(tempFileName, saveFialog.FileName);