0

I have few forms that export the grid data to excel, each time the form exports it calls the SaveFileDialog contol - for which I have a different form that remains the same for all the forms that need the SaveFileDialog, What I need to do is while saving the file, I want to display a default file name but it should be specific to the form not same for all the forms. I want to do that for C# windows application

Sejal
  • 1
  • 2
  • Take a look [here](https://msdn.microsoft.com/en-us/library/system.windows.forms.savefiledialog(v=vs.110).aspx) – sujith karivelil Dec 19 '16 at 07:32
  • 7
    Possible duplicate of [Default Filename SaveFileDialog](http://stackoverflow.com/questions/21199558/default-filename-savefiledialog) – huse.ckr Dec 19 '16 at 07:36

1 Answers1

3

There is property called FileName for SaveFileDialog which can be given for giving a default file name.

SaveFileDialog sfd = new SaveFileDialog();
sfd.FileName = "WhateverNameYouWant" //WithExtension
Mohit S
  • 13,723
  • 6
  • 34
  • 69