SlideShare a Scribd company logo
MODULE III
Topics
 DIALOG BOXES
 TIMER CONTROL
 CONTROL ARRAYS
DIALOG BOXES
 Used to exchange information between the
program and user.
 Contain common controls such as labels, text
boxes, option buttons, check boxes, command
buttons.
 Commonly used dialog boxes are
 MsgBox Function
 InputBox Function
MsgBox Function
 Used to display information during computation.
 Displays a given output string with one or more
command buttons.
 Syntax
 integer variable = MsgBox(string,integer,title)
 Function returns a positive integer depending on
the command button selected by the user.
 String argument represents the string to be
displayed.
 Integer argument represents the command
buttons that must appear.
 Title argument is the string that appears on the
title bar of the dialog box
Integer Argument Named Constants Resulting
Command Buttons
0 vbOkonly OK
1 vbOkCancel OK & Cancel
2 vbAbortRetryIgnore Abort, Retry, Ignore
3 vbYesNoCancel Yes, No, Cancel,
4 vbYesNo Yes, No
5 vbRetryCancel Retry, Cancel
testmsg = MsgBox("Click to test", 1, "Test message")
Or
testmsg = MsgBox("Click to test", vbOkCancel, "Test message")
Module iii part i
 Depending on the command button selected an
integer value is returned.
 In the previous example
 1 is returned to testmsg if OK button is selected
 2 is returned to testmsg if Cancel is selected
Command Button Return Value
OK 1
Cancel 2
Abort 3
Retry 4
Ignore 5
Yes 6
No 7
InputBox Function
 Used to accept an input.
 Include
 A string prompting the user for input
 A textbox where the user can enter the input
 Two command buttons- OK and Cancel
 Syntax
 String variable=InputBox(prompt, title,
default)
 prompt
 Represents the prompt for input.
 Title
 String that appears on the title bar of the box
 Default
 String that appear initially in the textbox of
InputBox
 Empty if the last arguemnt is not included in the
function
 n = InputBox("Enter the limit", "ARRAYS")
(In this example the last argument is omitted. 4 is
the input. )
The value returned to variable n is string. It can be
converted to integer using Val function
n = Val(InputBox("Enter the limit", "ARRAYS"))
Timer Control
 Used to create application involving timed events
 Digital clock, stop watch etc
 Placed in the form during design time.
 Does not appear on the form when the program is
executed.
 Important property- Interval
 Interval property is assigned with values ranging from
0 to 65,535.
 0 value disables timer.
 +ve value represents milliseconds
 Eg- 1000 represents 1 second interval, 60000
represent 1 minute interval
Control Arrays
 Array of controls.
 Multiple controls of the same type can be
grouped into an array with a common name.
 Each element is distinguished by the value of
index
 Created by placing a control in the Form Window
and assigning value 0 to its index property.
 Copy and paste control,with subsequent index
values(1,2,3….)
 Draw a control in the control array.
 While the control has the focus, choose Copy from
the Edit menu.
 From the Edit menu, choose Paste. Visual Basic displays
a dialog box asking you to confirm that you want to create
a control array. Choose Yes to confirm the action. This
control is assigned an index value of 1. The first control you
drew has a value of 0.
 The index value of each new array element corresponds to
the order in which the element was added to the control
array. When controls are added this way, most of the visual
properties, such as height, width, and color, are copied
from the first control in the control array to the new
controls.
MENUS IN VB
Drop-Down Menus
Pop-Up Menus
Drop-Down Menus
 Descend from the menu heading when user clicks
on the menu heading
Creating a Drop-Down Menu
 Click on the Menu Editor button in the toolbar.
 Select the Enabled and Visible check boxes
 Enter the caption & Name for each menu item
 Caption will appear in the large area at the
bottom of the Menu Editor.
 Example: Caption-Continents, name-
mnucontinents
 Press Enter key or Click Next Button
 Click the "right-arrow" button. A ellipsis (...) will
appear as the next item in the menu list,
indicating that this item is a level-two item.
 The ellipsis is the indentation pattern that
distinguishes menu heading from menu items.
 (The left arrow is for deleting indentation)
 Now enter the sub menu items by entering the
caption and name.
Caption Name
Africa mnuAfrica
Antarctica mnuAntarctica
Asia mnuAsia
Australia mnuAustralia
Europe mnuEurope
 Keyboard shortcuts can be added for accessing
menu from keyboard.
 Keyboard shortcuts are selected directly from the
Shortcut field within the Menu editor.
 Keyboard shortcuts must be unique.
A sample…
 Order of menu components
1. First menu heading
2. Corresponding menu items for first menu
3. Second menu heading
4. Corresponding menu items for second menu
and so on.
SUBMENU
 To create submenu, indent the submenu items
beneath the parent menu item.
 Menu item having submenu will be identified by a
right-pointing arrow at its edge.
POP UP MENU
 Can appear anywhere in a form.
 Appear in response to clicking the right mouse
button.
 also called context menus
 Created in the same manner as drop-down menu.
 But the visible feature of the main menu item
will be unchecked
 An event procedure must be entered as shown:
 Select the code editor window.
 Select Form in the left portion and MouseDown in
the right portion
 The first and last lines of the event procedure will
be generated automatically.
 Write the following code in the event procedure.
 If Button=vbRightButton Then
 PopupMenu <menuname>
 End if
 <menuname> must be the name of the menu (eg;
mnucontinents)

More Related Content

What's hot (17)

DOCX
Excel short cut keys and tips remaining
Nitin Aggarwal
 
PPTX
Vs c# lecture3
Saman M. Almufti
 
PDF
Excel shortcuts
Razzzz Kumar
 
PDF
Excel
Dreams Design
 
PPTX
Vs c# lecture5
Saman M. Almufti
 
PDF
100 keyboard shortcuts for windows 8
MINISTRY OF DEFENCE PAK
 
PPT
Excel for beginners class 3
Carlstadt Public Library
 
PDF
Excel Shortcuts
dev_12782
 
PPS
see how share price calculated in pre-opening session..MUST WATCH
CA Bhupesh Saxena
 
PDF
2 front panel
Ankush Jamthikar
 
DOCX
Open Office Calc : Level 1
thinkict
 
PDF
Windows Forms For Beginners Part - 1
Bhushan Mulmule
 
PPT
Graphing Calculator
Indian Hills Middle School
 
PPTX
Spf chapter 03 WinForm
Hock Leng PUAH
 
PDF
Windows Forms For Beginners Part - 4
Bhushan Mulmule
 
PDF
Ppt shortcut keys
Rakesh Kumar Pandey
 
DOCX
Maliram poonia project
Apex institute of engineering & technology
 
Excel short cut keys and tips remaining
Nitin Aggarwal
 
Vs c# lecture3
Saman M. Almufti
 
Excel shortcuts
Razzzz Kumar
 
Vs c# lecture5
Saman M. Almufti
 
100 keyboard shortcuts for windows 8
MINISTRY OF DEFENCE PAK
 
Excel for beginners class 3
Carlstadt Public Library
 
Excel Shortcuts
dev_12782
 
see how share price calculated in pre-opening session..MUST WATCH
CA Bhupesh Saxena
 
2 front panel
Ankush Jamthikar
 
Open Office Calc : Level 1
thinkict
 
Windows Forms For Beginners Part - 1
Bhushan Mulmule
 
Graphing Calculator
Indian Hills Middle School
 
Spf chapter 03 WinForm
Hock Leng PUAH
 
Windows Forms For Beginners Part - 4
Bhushan Mulmule
 
Ppt shortcut keys
Rakesh Kumar Pandey
 

Similar to Module iii part i (20)

PPT
Chapter 02
Terry Yoast
 
PPTX
Windowforms controls c#
prabhu rajendran
 
PDF
VB PPT by ADI PART4.pdf
AdiseshaK
 
PDF
VB PPT by ADI PART4.pdf
Prof. Dr. K. Adisesha
 
PDF
Vb6 ch.7-3 cci
Fahim Khan
 
DOCX
c programming 109.docx
write31
 
PPTX
01.excell basics
Steven Alphonce
 
PPTX
ITS-16163-Module 8-Graphic User Interface (GUI)
oudesign
 
DOCX
The visual studio start page is shown in the figure below
Tan Ps
 
PDF
Ma3696 Lecture 2
Brunel University
 
PPTX
Debugger Of Turbo C
mohit2501
 
PPTX
Excel mod 5 PowerPoint
Wilmington High School
 
PPT
GUI -THESIS123
Aparna Reddy
 
PPTX
How to use a spreadsheet
Swarnima Tiwari
 
PDF
Create formsexcel
Ravi Gajul
 
PDF
Autodesk maya 2016 basic guide
Đỗ Hải
 
PPTX
DOC-20230724-WA0011..pptxyffhjingtrfhiijh
MAADHESH2
 
PDF
excell.pdf
ssuser8f8817
 
PPT
Introduction to Excel
Najma Alam
 
Chapter 02
Terry Yoast
 
Windowforms controls c#
prabhu rajendran
 
VB PPT by ADI PART4.pdf
AdiseshaK
 
VB PPT by ADI PART4.pdf
Prof. Dr. K. Adisesha
 
Vb6 ch.7-3 cci
Fahim Khan
 
c programming 109.docx
write31
 
01.excell basics
Steven Alphonce
 
ITS-16163-Module 8-Graphic User Interface (GUI)
oudesign
 
The visual studio start page is shown in the figure below
Tan Ps
 
Ma3696 Lecture 2
Brunel University
 
Debugger Of Turbo C
mohit2501
 
Excel mod 5 PowerPoint
Wilmington High School
 
GUI -THESIS123
Aparna Reddy
 
How to use a spreadsheet
Swarnima Tiwari
 
Create formsexcel
Ravi Gajul
 
Autodesk maya 2016 basic guide
Đỗ Hải
 
DOC-20230724-WA0011..pptxyffhjingtrfhiijh
MAADHESH2
 
excell.pdf
ssuser8f8817
 
Introduction to Excel
Najma Alam
 
Ad

Recently uploaded (20)

PPTX
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
PPTX
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
PPTX
Nutrition Quiz bee for elementary 2025 1.pptx
RichellMarianoPugal
 
PDF
A guide to responding to Section C essay tasks for the VCE English Language E...
jpinnuck
 
PPTX
Gupta Art & Architecture Temple and Sculptures.pptx
Virag Sontakke
 
PDF
Right to Information.pdf by Sapna Maurya XI D
Directorate of Education Delhi
 
PPTX
IDEAS AND EARLY STATES Social science pptx
NIRANJANASSURESH
 
PPTX
I INCLUDED THIS TOPIC IS INTELLIGENCE DEFINITION, MEANING, INDIVIDUAL DIFFERE...
parmarjuli1412
 
PDF
Exploring-the-Investigative-World-of-Science.pdf/8th class curiosity/1st chap...
Sandeep Swamy
 
PPTX
Electrophysiology_of_Heart. Electrophysiology studies in Cardiovascular syste...
Rajshri Ghogare
 
PPTX
Unlock the Power of Cursor AI: MuleSoft Integrations
Veera Pallapu
 
PPTX
Orientation MOOCs on SWAYAM for Teachers
moocs1
 
PPTX
INTESTINAL OBSTRUCTION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
PPTX
Artificial Intelligence in Gastroentrology: Advancements and Future Presprec...
AyanHossain
 
PDF
Stepwise procedure (Manually Submitted & Un Attended) Medical Devices Cases
MUHAMMAD SOHAIL
 
PDF
EXCRETION-STRUCTURE OF NEPHRON,URINE FORMATION
raviralanaresh2
 
PDF
water conservation .pdf by Nandni Kumari XI C
Directorate of Education Delhi
 
PPTX
Top 10 AI Tools, Like ChatGPT. You Must Learn In 2025
Digilearnings
 
PPTX
How to Manage Resupply Subcontracting in Odoo 18
Celine George
 
PPTX
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
Nutrition Quiz bee for elementary 2025 1.pptx
RichellMarianoPugal
 
A guide to responding to Section C essay tasks for the VCE English Language E...
jpinnuck
 
Gupta Art & Architecture Temple and Sculptures.pptx
Virag Sontakke
 
Right to Information.pdf by Sapna Maurya XI D
Directorate of Education Delhi
 
IDEAS AND EARLY STATES Social science pptx
NIRANJANASSURESH
 
I INCLUDED THIS TOPIC IS INTELLIGENCE DEFINITION, MEANING, INDIVIDUAL DIFFERE...
parmarjuli1412
 
Exploring-the-Investigative-World-of-Science.pdf/8th class curiosity/1st chap...
Sandeep Swamy
 
Electrophysiology_of_Heart. Electrophysiology studies in Cardiovascular syste...
Rajshri Ghogare
 
Unlock the Power of Cursor AI: MuleSoft Integrations
Veera Pallapu
 
Orientation MOOCs on SWAYAM for Teachers
moocs1
 
INTESTINAL OBSTRUCTION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
Artificial Intelligence in Gastroentrology: Advancements and Future Presprec...
AyanHossain
 
Stepwise procedure (Manually Submitted & Un Attended) Medical Devices Cases
MUHAMMAD SOHAIL
 
EXCRETION-STRUCTURE OF NEPHRON,URINE FORMATION
raviralanaresh2
 
water conservation .pdf by Nandni Kumari XI C
Directorate of Education Delhi
 
Top 10 AI Tools, Like ChatGPT. You Must Learn In 2025
Digilearnings
 
How to Manage Resupply Subcontracting in Odoo 18
Celine George
 
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
Ad

Module iii part i

  • 2. Topics  DIALOG BOXES  TIMER CONTROL  CONTROL ARRAYS
  • 3. DIALOG BOXES  Used to exchange information between the program and user.  Contain common controls such as labels, text boxes, option buttons, check boxes, command buttons.  Commonly used dialog boxes are  MsgBox Function  InputBox Function
  • 4. MsgBox Function  Used to display information during computation.  Displays a given output string with one or more command buttons.  Syntax  integer variable = MsgBox(string,integer,title)
  • 5.  Function returns a positive integer depending on the command button selected by the user.  String argument represents the string to be displayed.  Integer argument represents the command buttons that must appear.  Title argument is the string that appears on the title bar of the dialog box
  • 6. Integer Argument Named Constants Resulting Command Buttons 0 vbOkonly OK 1 vbOkCancel OK & Cancel 2 vbAbortRetryIgnore Abort, Retry, Ignore 3 vbYesNoCancel Yes, No, Cancel, 4 vbYesNo Yes, No 5 vbRetryCancel Retry, Cancel testmsg = MsgBox("Click to test", 1, "Test message") Or testmsg = MsgBox("Click to test", vbOkCancel, "Test message")
  • 8.  Depending on the command button selected an integer value is returned.  In the previous example  1 is returned to testmsg if OK button is selected  2 is returned to testmsg if Cancel is selected Command Button Return Value OK 1 Cancel 2 Abort 3 Retry 4 Ignore 5 Yes 6 No 7
  • 9. InputBox Function  Used to accept an input.  Include  A string prompting the user for input  A textbox where the user can enter the input  Two command buttons- OK and Cancel  Syntax  String variable=InputBox(prompt, title, default)
  • 10.  prompt  Represents the prompt for input.  Title  String that appears on the title bar of the box  Default  String that appear initially in the textbox of InputBox  Empty if the last arguemnt is not included in the function
  • 11.  n = InputBox("Enter the limit", "ARRAYS") (In this example the last argument is omitted. 4 is the input. ) The value returned to variable n is string. It can be converted to integer using Val function n = Val(InputBox("Enter the limit", "ARRAYS"))
  • 12. Timer Control  Used to create application involving timed events  Digital clock, stop watch etc  Placed in the form during design time.  Does not appear on the form when the program is executed.
  • 13.  Important property- Interval  Interval property is assigned with values ranging from 0 to 65,535.  0 value disables timer.  +ve value represents milliseconds  Eg- 1000 represents 1 second interval, 60000 represent 1 minute interval
  • 14. Control Arrays  Array of controls.  Multiple controls of the same type can be grouped into an array with a common name.  Each element is distinguished by the value of index  Created by placing a control in the Form Window and assigning value 0 to its index property.  Copy and paste control,with subsequent index values(1,2,3….)
  • 15.  Draw a control in the control array.  While the control has the focus, choose Copy from the Edit menu.  From the Edit menu, choose Paste. Visual Basic displays a dialog box asking you to confirm that you want to create a control array. Choose Yes to confirm the action. This control is assigned an index value of 1. The first control you drew has a value of 0.  The index value of each new array element corresponds to the order in which the element was added to the control array. When controls are added this way, most of the visual properties, such as height, width, and color, are copied from the first control in the control array to the new controls.
  • 16. MENUS IN VB Drop-Down Menus Pop-Up Menus
  • 17. Drop-Down Menus  Descend from the menu heading when user clicks on the menu heading
  • 18. Creating a Drop-Down Menu  Click on the Menu Editor button in the toolbar.
  • 19.  Select the Enabled and Visible check boxes
  • 20.  Enter the caption & Name for each menu item  Caption will appear in the large area at the bottom of the Menu Editor.  Example: Caption-Continents, name- mnucontinents  Press Enter key or Click Next Button  Click the "right-arrow" button. A ellipsis (...) will appear as the next item in the menu list, indicating that this item is a level-two item.  The ellipsis is the indentation pattern that distinguishes menu heading from menu items.  (The left arrow is for deleting indentation)
  • 21.  Now enter the sub menu items by entering the caption and name. Caption Name Africa mnuAfrica Antarctica mnuAntarctica Asia mnuAsia Australia mnuAustralia Europe mnuEurope
  • 22.  Keyboard shortcuts can be added for accessing menu from keyboard.  Keyboard shortcuts are selected directly from the Shortcut field within the Menu editor.  Keyboard shortcuts must be unique.
  • 24.  Order of menu components 1. First menu heading 2. Corresponding menu items for first menu 3. Second menu heading 4. Corresponding menu items for second menu and so on.
  • 25. SUBMENU  To create submenu, indent the submenu items beneath the parent menu item.  Menu item having submenu will be identified by a right-pointing arrow at its edge.
  • 26. POP UP MENU  Can appear anywhere in a form.  Appear in response to clicking the right mouse button.  also called context menus  Created in the same manner as drop-down menu.  But the visible feature of the main menu item will be unchecked  An event procedure must be entered as shown:
  • 27.  Select the code editor window.  Select Form in the left portion and MouseDown in the right portion  The first and last lines of the event procedure will be generated automatically.  Write the following code in the event procedure.  If Button=vbRightButton Then  PopupMenu <menuname>  End if  <menuname> must be the name of the menu (eg; mnucontinents)