简体   繁体   中英

Default file name for SaveFileDialog c#

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM