






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of dialog boxes in c# programming, focusing on the openfiledialog, savefiledialog, and folderbrowserdialog controls. Learn about their features, properties, and usage. Discover how to restrict file types, set initial directories, and prevent file overwriting.
Typology: Slides
1 / 12
This page cannot be seen from the preview
Don't miss anything!







All dialog boxes derive from the CommonDialog class and share similar features The OpenFileDialog and SaveFileDialog controls are derived from the CommonDialog class These classes allow the end user to select a file to open or save The FolderBrowserDialog control also derives from the CommonDialog class This control allows the end user to select a folder
The InitialDirectory property contains the initial folder where the search for files begins The OverwritePrompt property applies only to the SaveFileDialog. If True , the end user will be prompted before a file is overwritten The RestoreDirectory property defines whether the current directory will be restored after the end user selects a file The ShowDialog method displays the respective dialog box
The Filter Property
(introduction)
The Filter property restricts the files displayed based on a file extension A filter consists of A description Followed by a vertical bar Followed by the actual filter Multiple filters can be connected together Do not put spaces between the vertical bars
Using the
SaveFileDialog Control
The SaveFileDialog control works the same way as the OpenFileDialog control Set the OverwritePrompt property to True to prevent the end user from accidentally overwriting files
The FolderBrowserDialog
(Introduction)
Use the FolderBrowserDialog to browse for folders instead of files Members The Description property contains the text appearing in the title bar The RootFolder property contains the topmost folder appearing in the dialog box The SelectedPath property contains the folder selected by the end user The ShowDialog method displays the dialog box
Color (About)
Color is made up of RGB values and an “alpha” value that controls opacity Values range between 0 and 255 255,255,255 is white 0,0,0 is black
The ColorDialog
(Introduction)
It works the same way as the other dialog boxes Call ShowDialog to display the dialog box The Color property contains the selected color Properties AllowFullOpen allows the user to select custom colors FullOpen displays the full color palette