I am using the below code to export data to csv format. Normally its stored into the system desktop. i want to save various location thats why need save dialog. But i can't do this please help me to do it..
My partial code is here :
StringBuilder sb = new StringBuilder();
var columnNames = dt.Columns.Cast<DataColumn>().Select(column => column.ColumnName).ToArray();
sb.AppendLine(string.Join(",", columnNames));
foreach (DataRow row in dt.Rows)
{ var fields = row.ItemArray.Select(field => field.ToString().Replace(","," "));
sb.AppendLine(string.Join(",", fields));
}
File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) +"/test.csv", sb.ToString());