private void buttonSave_Click(object sender, EventArgs e) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Excel Documents (*.xls)|*.xls"; sfd.FileName = "export.xls"; if (sfd.ShowDialog() == DialogResult.OK) { //ToCsV(dataGridView1, @"c:\export.xls"); dbc.ToCsV(dataGridView1, sfd.FileName); // Here dataGridview1 is your grid view name } }