Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Previous Versions
.NET Framework 2.0

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
.NET Framework Class Library
SaveFileDialog Class

Prompts the user to select a location for saving a file. This class cannot be inherited.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Visual Basic (Declaration)
Public NotInheritable Class SaveFileDialog
    Inherits FileDialog
Visual Basic (Usage)
Dim instance As SaveFileDialog
C#
public sealed class SaveFileDialog : FileDialog
C++
public ref class SaveFileDialog sealed : public FileDialog
J#
public final class SaveFileDialog extends FileDialog
JScript
public final class SaveFileDialog extends FileDialog

This class can either open and overwrite an existing file or create a new file.

Most of the functionality for this class is found in the FileDialog class.

Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows CE Platform Note: On the Pocket PC, if you do not specify a file name extension, the control appends the extension of the selected type from the dialog box. On Windows CE, the control does not append an extension. All platforms support the FilterIndex property, which returns the index of the selected extension filter.

The following code example illustrates creating a SaveFileDialog, setting members, calling the dialog box using the ShowDialog method, and saving the current file. The example requires a form with a button placed on it.

System.Object
   System.MarshalByRefObject
     System.ComponentModel.Component
       System.Windows.Forms.CommonDialog
         System.Windows.Forms.FileDialog
          System.Windows.Forms.SaveFileDialog
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Missing code example.      Jim Walker - MSFT   |   Edit   |   Show History
Later versions of this document contain updates and corrections. Please use the version selection box at the top of this page to view the latest version.
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker