Name

SaveFileDialog Class

Namespace

System.Windows.Forms

Createable

Yes

Description

Represents a common dialog box for selecting or saving a file. The most common use of this dialog box is to ask the user for the name of a file, after which we can use VB’s functions to save an existing file under that name, since the dialog box itself does not handle the process of saving a file.

The SaveFileDialog object has properties for setting the initial appearance and functionality of the dialog box, a property for returning the filename selected by the user, as well as a method for showing the dialog box. The object does not itself save the file, but instead provides the information that allows your code to do this programmatically.

A SaveFileDialog object can be instantiated as follows:

Dim oSaveDlg As New SaveFileDialog

Selected SaveFileDialog Members

The following is a brief list of some of the more important members of the SaveFileDialog class:

AddExtension property

Gets or sets a Boolean value that determines whether the default file extension is automatically added to the FileName property if the user fails to enter an extension. Its default value is True.

DefaultExt property

Gets or sets a String that defines the default file extension. The string should consist of the file extension only, without a period.

FileName property

Gets or sets a String containing the name that the user selected or entered in the dialog box.

Filter property

Gets or sets a String containing the current filter, ...

Get VB .NET Language in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.