JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Using the SaveFileDialog Class

As discussed in the In Depth section of this chapter, you can use Save File dialogs to get the name of the file that the user wants to save data to. Here is the class hierarchy for this class:

Object
   MarshalByRefObject
      Component
         CommonDialog
            FileDialog
               SaveFileDialog

You can find the notable public properties of SaveFileDialog objects in Table 9.12, the notable public methods in Table 9.13, and the notable public events in Table 9.14.

Table 9.12: Noteworthy public properties of SaveFileDialog objects.

Property

Means

AddExtension

Gets/sets whether the dialog will add an extension to a file name if the user doesn't supply an extension.

CheckFileExists

Gets/sets whether the dialog box displays a warning if the user specifies a file that does not exist.

CheckPathExists

Gets/sets whether the dialog box displays a warning if the user specifies a path that does not exist.

CreatePrompt

Gets/sets whether the dialog box asks the user if it should create a file if the user specifies a nonexistent file.

DefaultExt

Gets/sets the default file extension.

FileName

Gets/sets the file name selected in the file dialog box.

FileNames

Gets the file names of all selected files.

Filter

Gets/sets the current file name filter string, which sets the choices that appear in the "Save as file type" or "Files of type" box.

FilterIndex

Gets/sets the index of the filter selected in the file dialog box.

InitialDirectory

Gets/sets the initial directory used in the file dialog box.

OverwritePrompt

Gets/sets whether the dialog displays a warning if the user specifies a name that already exists.

RestoreDirectory

Gets/sets whether the dialog box should restore the original directory before closing.

ShowHelp

Gets/sets whether the Help button should be displayed.

Title

Gets/sets the file dialog box title.

ValidateNames

Gets/sets whether the dialog box accepts only valid (that is, Win32) file names.

Table 9.13: Noteworthy public methods of SaveFileDialog objects.

Method

Means

OpenFile

Opens the file with read/write permission selected by the user.

Reset

Resets all dialog options to their default values.

ShowDialog

Shows the dialog.

Table 9.14: Noteworthy public events of SaveFileDialog objects.

Event

Means

FileOk

Occurs when the user clicks the Open or Save button.

HelpRequest

Occurs when the user clicks the Help button.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor