private void exportToCSV() { SaveFileDialog saveFileDialogCSV = new SaveFileDialog(); saveFileDialogCSV.InitialDirectory = Application.ExecutablePath.ToString(); saveFileDialogCSV.Filter = "CSV files (*.csv)|*.csv|All files (*.*)|*.*"; saveFileDialogCSV.FilterIndex = 1; saveFileDialogCSV.RestoreDirectory = true; //if (rdbSelectedTable.Checked) //{ string tableName = "ProductList"; string fullPath = ""; try { FolderSelect dlg = new FolderSelect(); if (dlg.ShowDialog() == DialogResult.OK) { DirectoryInfo info = dlg.info; fullPath = dlg.fullPath; } else { return; } } catch (Exception err) { Console.WriteLine(err.Message); } fullPath = fullPath + "\\" + tableName + ".csv"; exportToCSVfile(fullPath); }