What Dialog Box Is Used To Change The Save Location Of A Library
VB.Internet - SaveFileDialog Control
The SaveFileDialog control prompts the user to select a location for saving a file and allows the user to specify the proper name of the file to save data. The SaveFileDialog control class inherits from the abstract form FileDialog.
Following is the Relieve File dialog box −
Backdrop of the SaveFileDialog Control
The following are some of the commonly used properties of the SaveFileDialog control −
Sr.No. | Property & Description |
---|---|
1 | AddExtension Gets or sets a value indicating whether the dialog box automatically adds an extension to a file name if the user omits the extension. |
ii | CheckFileExists Gets or sets a value indicating whether the dialog box displays a warning if the user specifies a file name that does not exist. |
3 | CheckPathExists Gets or sets a value indicating whether the dialog box displays a warning if the user specifies a path that does not exist. |
4 | CreatePrompt Gets or sets a value indicating whether the dialog box prompts the user for permission to create a file if the user specifies a file that does not exist. |
5 | DefaultExt Gets or sets the default file name extension. |
6 | DereferenceLinks Gets or sets a value indicating whether the dialog box returns the location of the file referenced by the shortcut or whether it returns the location of the shortcut (.lnk). |
7 | FileName Gets or sets a string containing the file name selected in the file dialog box. |
8 | FileNames Gets the file names of all selected files in the dialog box. |
nine | Filter Gets or sets the current file proper noun filter string, which determines the choices that appear in the "Save as file blazon" or "Files of type" box in the dialog box. |
10 | FilterIndex Gets or sets the index of the filter currently selected in the file dialog box. |
11 | InitialDirectory Gets or sets the initial directory displayed past the file dialog box. |
12 | OverwritePrompt Gets or sets a value indicating whether the Save As dialog box displays a alert if the user specifies a file name that already exists. |
13 | RestoreDirectory Gets or sets a value indicating whether the dialog box restores the electric current directory earlier endmost. |
14 | ShowHelp Gets or sets a value indicating whether the Help button is displayed in the file dialog box. |
15 | SupportMultiDottedExtensions Gets or sets whether the dialog box supports displaying and saving files that have multiple file name extensions. |
16 | Championship Gets or sets the file dialog box championship. |
17 | ValidateNames Gets or sets a value indicating whether the dialog box accepts but valid Win32 file names. |
Methods of the SaveFileDialog Command
The post-obit are some of the ordinarily used methods of the SaveFileDialog control −
Sr.No. | Method Name & Description |
---|---|
ane | OpenFile Opens the file with read/write permission. |
two | Reset Resets all dialog box options to their default values. |
Case
In this instance, let's save the text entered into a rich text box by the user using the save file dialog box. Take the following steps −
-
Elevate and drop a Label control, a RichTextBox control, a Button control and a SaveFileDialog control on the grade.
-
Prepare the Text holding of the label and the button control to 'Nosotros appreciate your comments' and 'Salvage Comments', respectively.
-
Double-click the Salve Comments button and change the code of the Click event as shown −
Private Sub Button1_Click(sender Equally Object, east As EventArgs) Handles Button1.Click SaveFileDialog1.Filter = "TXT Files (*.txt*)|*.txt" If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK _ So My.Computer.FileSystem.WriteAllText _ (SaveFileDialog1.FileName, RichTextBox1.Text, Truthful) End If Stop Sub
When the application is compiled and run using Starting time button bachelor at the Microsoft Visual Studio tool bar, information technology volition testify the following window −
We take set the Filter property of the SaveFileDialog control to display text file types with .txt extensions only.
Write some text in the text box and click on the Save Comment button to save the text as a text file in your computer.
vb.net_dialog_boxes.htm
Source: https://www.tutorialspoint.com/vb.net/vb.net_savefile_dialog.htm
Posted by: tiedemansumate.blogspot.com
0 Response to "What Dialog Box Is Used To Change The Save Location Of A Library"
Post a Comment