Professional Documents
Culture Documents
2.4 Dialog Boxes
2.4 Dialog Boxes
.NET TECHNOLOGY
2.4 Apply Dialog Boxes.
2.4 APPLY DIALOG BOXES.
By the end of the class, students should be
able to:
SaveFileDialog
Standard Prefix : sfd
Example : sfdSaveFile.ShowDialog()
OPENFILE DIALOG & SAVEFILE DIALOG
Properties:
1. CheckFileExist /CheckPathExist – determine whether
user can specify a file/path name that does not exist.
2. FileName – gets a string containing the file name to
open. Contains both path and file name.
3. Filter – control the types of file that will displayed for
selection.
4. FilterIndex – work with Filter property and has an
index. It defines which filter in a list of filters is active.
5. InitialDirectory – defines initial folder to open / save a
file.
6. MultiSelect – if True, allows user to select multiple files
to open/save
7. Title – defines the text that appear in the title bar for
open/save dialog control
OPENFILE DIALOG & SAVEFILE DIALOG
Examples:
ofdMain.Filter = “Text Files (*.txt) |*.txt|” & _
“Rich Text (*.rtf) |*.rtf|All Files (*.*)|*.*”
ofdMain.FilterIndex = 2
ofdMain.ShowDialog()
COLOR DIALOG BOX
2 section: display basic and allows the user
to define custom colors.
SETTING COLOR – COLOR DIALOG BOX
Standard Prefix : cd
Example : cdSelectColor.ShowDialog()
SETTING COLOR – COLOR DIALOG BOX
Syntax : DialogObject.ShowDialog()
Properties :
cdSelectColor.ShowDialog()
‘Show dialog box
lblDisplay.BackColor=cdSelectColor.Color
‘Color
FONT DIALOG BOX
Enabled user to select and setting font
SETTING FONT – FONT DIALOG BOX
Set the properties of the dialog box and call
the ShowDialog method to display the
FontDialog.
Standard Prefix : fd
Example : fdSelectFont.ShowDialog()
SETTING FONT – FONT DIALOG BOX
Statement : fdSelectFont.ShowDialog()
Properties :
fdSelectFont.ShowDialog()
‘Show dialog box
lblDisplay.Font=fdSelectFont.Font
‘Select Font
lblDisplay.Font=fdSelectFont.Color
‘Select Font Color