I would like to create SaveFileDialog with default file name from value DataGridViewCells
So far I tried
priva
The problem is that you need to use:
myDataGridView.SelectedCells[0].Value.ToString();
instead of
myDataGridView.SelectedCells[2].Value.ToString();
Until you don't select 3 or more cells with mouse or whatsoever. You can index like [2]
private void buttonSave_Click(object sender, EventArgs e)
{
SaveFileDialog saveFile = new SaveFileDialog();
saveFile.FileName = myDataGridView.SelectedCells[0].Value.ToString();
saveFile.ShowDialog();
}
Does this work for you?