Documente Academic
Documente Profesional
Documente Cultură
ANDHRA PRADESH
Name of the faculty : G. Radha
Designation : Lecturer
Branch : CCP
Institute : 026 - SG Govt. Polytechnic,
Adilabad
Year / Semester : III Year / V Semester
Subject : Visual Basic – I
Subject Code : CCP - 503
Topic : Understand Menus and
Common dialogue control
Duration : 50 Mts.
Sub Topic : Common Dialogue Control
Teaching Aids : Animations & Images
CCP-503.20 1
Recap
CCP-503.20 2
Objectives :
CCP-503.20 3
Common Dialogue Control
CCP-503.20 4
Add a Common Dialogue Box to a Form
CCP-503.20 5
Example on Common Dialogue Control
CCP-503.20 6
Example on Common Dialogue Control
Name Commondialog1
CCP-503.20 7
Example on Common Dialogue Control
The following are Menu Items to be added to
the Form.
Caption Name
&File MnFile
….Color MnColor
….Open MnOpen
….- MnSep
….E&xit MnExit
CCP-503.20 8
Example on Common Dialogue Control
CCP-503.20 9
Example on Common Dialogue Control
The following code is entered in the
MnColor_Click() procedure
Private Sub MnColor_Click()
On Error GoTo errortrap
CommonDialog1.Action = 3 'Display Color Dialogue Box'
Cmdialog.BackColor = CommonDialog1.Color
Exit Sub
errortrap:
MsgBox "Dialog Box is Cancelled"
End Sub
CCP-503.20 10
Example on Common Dialogue Control
CCP-503.20 11
Example on Common Dialogue Control
Therefore, if the Cancel button is pressed when
the dialog box is displayed, the Errortrap, which
has been set, displays the message “Dialog Box is
Cancelled” and the dialog box disappears.
CCP-503.20 12
Color Dialog Box
CCP-503.20 13
Changing of Form Back Color
CCP-503.20 14
When the Cancel Button is Clicked
CCP-503.20 15
Example on Common Dialogue Control
The following code is entered in the
MnOpen_Click() procedure
Private Sub MnOpen_Click()
Dim Filter As String
On Error GoTo errortrap
Filter = "all Files (*.*) | *.*"
CommonDialog1.Filter = Filter
CommonDialog1.Action = 1
MsgBox "Selected File is:" +
ommonDialog1.FileName
Exit Sub
errortrap:
MsgBox "Dialog box is cancelled"
Exit Sub CCP-503.20 16
End Sub
Example on Common Dialogue Control
CCP-503.20 17
Open Menu Control clicked
CCP-503.20 18
When a File is Selected in Dialog Box
CCP-503.20 19
When the Cancel Button is Clicked
CCP-503.20 20
Example on Common Dialogue Control
CCP-503.20 21
Example on Common Dialogue Control
CCP-503.20 22
Summary
Common Dialogue Control.
CCP-503.20 23
Quiz
CCP-503.20 24
• The option of common Dialog box that
helps in font selection is
A) 4
B) 2
C) 1
D) 6
CCP-503.20 25
----------------- is used to display
commonly used Dialogue Boxes?
CCP-503.20 26
Frequently Asked Questions
CCP-503.20 27
Assignment
CCP-503.20 28