Questions tagged [savefiledialog]

The SaveFileDialog is a (component) class in the .NET Framework that prompts the user to select a location for saving a file.

The SaveFileDialog component allows users to browse the file system and select files to be saved. The dialog box returns the path and name of the file the user has selected in the dialog box. However, you must write the code to actually write the files to disk.

654 questions
83
votes
7 answers

How to make a browser display a "save as dialog" so the user can save the content of a string to a file on his system?

How can I make a browser display a "save as dialog" so the user can save the content of a string to a file on his system? For example: var myString = "my string with some stuff"; save_to_filesystem(myString,"myString.txt"); Resulting in something…
MaiaVictor
  • 51,090
  • 44
  • 144
  • 286
44
votes
2 answers

Multiple types in a SaveFileDialog filter

In my SaveFileDialog I have multiple types in the filter, however when viewing the dialog if I choose a filter to view files of that type in the directory I am only able to see files for the first and last filters. bool save; SaveFileDialog…
Eamonn McEvoy
  • 8,876
  • 14
  • 53
  • 83
27
votes
11 answers

A Generic error occurs at GDI+ at Bitmap.Save() after using SaveFileDialog

I use the following code block with some more code inside the using block: using (System.Drawing.Bitmap tempImg = (System.Drawing.Bitmap)tempObj.GetData(System.Windows.Forms.DataFormats.Bitmap)) { // ... …
Dulini Atapattu
  • 2,735
  • 8
  • 33
  • 47
24
votes
2 answers

Save file with appropriate extension in a Save File prompt

In my application I use a SaveFileDialog to pop up a Save As window. I have restricted in the file type section the file to be saved as .dat with the following code. sfdialog.Filter = "Data Files (*.dat*)|*.dat*"; What I want to know how to do is…
novacara
  • 2,207
  • 4
  • 24
  • 34
23
votes
5 answers

Default Filename SaveFileDialog

I would like to create SaveFileDialog with default file name from value DataGridViewCells So far I tried private void buttonSave_Click(object sender, EventArgs e) { //first //mySaveFileDialog.FileName =…
Surya Matadewa
  • 1,017
  • 5
  • 19
  • 38
19
votes
9 answers

How can I use the common Save As dialog from VBScript?

I'd like to have my VBScript display the Windows Save As dialog box, but I could not find out how to do it. Using this code: Dim sfd Set sfd = CreateObject("UserAccounts.CommonDialog") sfd.ShowOpen I can get an Open dialog, but there is no ShowSave…
JayK
  • 3,006
  • 1
  • 20
  • 26
15
votes
3 answers

Notepad++ replace "Save" Common File Dialog Box

In Notepad++ (Windows 7), is there a way to disable the Common File Dialog Box when saving a file? I would like to replace it with the standard Save File Dialog Box. Notepad++ uses this dialog box for saving: I would like to use the following…
ImYongSo
  • 151
  • 4
13
votes
5 answers

Writing a Text File in memory and saving it with savefiledialog

I am trying to make a text file in memory, add some lines to it and at the end save the file in a text file. I can handle the savedialog part but I dont know how to get the text file from memory. Any help and tips will be appriciated. What I am…
Dumbo
  • 13,555
  • 54
  • 184
  • 288
12
votes
2 answers

Save File to MyDocuments + App Folder

I am trying to save my .NET application settings file to the user's %MyDocument%\MyApplication folder, but I don't know how to check for an existing folder\file, and create or append the folder\file on save. I don't want to open a saveFileDialog…
Jeagr
  • 1,038
  • 6
  • 16
  • 30
11
votes
3 answers

Any way to circumvent "Dialogs must be user-initiated" exception?

My app has a 'open file' button. Before launching the OpenFileDialog, it asks whether the user wants to save the current file, and if they do, it launches a SaveFileDialog. It then launches the OpenFileDialog. Pretty standard stuff. My problem is…
user495625
  • 301
  • 2
  • 11
10
votes
3 answers

C# SaveFileDialog in specific folder

I use SaveFileDialog to select the path where I want to save a file. I set InitialDirectory to some folder, but I want to limit the save locations to that folder or subfolders of that folder. Is this possible? SaveFileDialog dialog = new…
Mircea Ispas
  • 20,260
  • 32
  • 123
  • 211
10
votes
4 answers

WPF SaveFileDialog DefaultExt ignored?

var dlg = new SaveFileDialog(); dlg.FileName = "graph"; dlg.DefaultExt = ".bmp"; dlg.Filter = "PNG|*.png|DOT|*.dot|Windows Bitmap Format|*.bmp|GIF|*.gif|JPEG|*.jpg|PDF|*.pdf|Scalable Vector Graphics|*.svg|Tag Image File Format|*.tiff"; The…
mpen
  • 272,448
  • 266
  • 850
  • 1,236
10
votes
3 answers

How can I prompt a user to choose a location to save a file?

In my main Form I have a method called SavePDFDocument(): private void SavePDFDocument() { PDFWrapper pdfWrapper = new PDFWrapper(); pdfWrapper.CreatePDF(horizontalPictureScroller1.GetPictures(), "pdfDocument.pdf"); } As you can see, right…
delete
10
votes
3 answers

(Save Dialog) How to change file extension automatically on file filter change in Vista/Win7?

While showing a save dialog, I want to hook user's filter type change and change file extension automatically. (e.g. like MSPaint's "Save As" operation.) With TSaveDialog and setting UseLatestCommonDialogs := False, I can handle this by the…
benok
  • 688
  • 1
  • 6
  • 21
10
votes
3 answers

When does Microsoft.Win32.OpenFileDialog.ShowDialog() return null?

OpenFileDialog's ShowDialog method returns a nullable boolean, set to true if the user clicked OK or false if he clicked Cancel. When does it return null? The documentation does not say.
sourcenouveau
  • 29,356
  • 35
  • 146
  • 243
1
2 3
43 44