SlideShare a Scribd company logo
1 of 27
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")
 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)

Excel short cut keys and tips remaining
Excel short cut keys and tips remainingExcel short cut keys and tips remaining
Excel short cut keys and tips remaining
 
Vs c# lecture3
Vs c# lecture3Vs c# lecture3
Vs c# lecture3
 
Excel shortcuts
Excel shortcutsExcel shortcuts
Excel shortcuts
 
Excel
ExcelExcel
Excel
 
Vs c# lecture5
Vs c# lecture5Vs c# lecture5
Vs c# lecture5
 
100 keyboard shortcuts for windows 8
100 keyboard shortcuts for windows 8100 keyboard shortcuts for windows 8
100 keyboard shortcuts for windows 8
 
Excel for beginners class 3
Excel for beginners class 3Excel for beginners class 3
Excel for beginners class 3
 
Excel Shortcuts
Excel ShortcutsExcel Shortcuts
Excel Shortcuts
 
see how share price calculated in pre-opening session..MUST WATCH
see how share price calculated in pre-opening session..MUST WATCHsee how share price calculated in pre-opening session..MUST WATCH
see how share price calculated in pre-opening session..MUST WATCH
 
2 front panel
2  front panel2  front panel
2 front panel
 
Open Office Calc : Level 1
Open Office Calc : Level 1Open Office Calc : Level 1
Open Office Calc : Level 1
 
Windows Forms For Beginners Part - 1
Windows Forms For Beginners Part - 1Windows Forms For Beginners Part - 1
Windows Forms For Beginners Part - 1
 
Graphing Calculator
Graphing CalculatorGraphing Calculator
Graphing Calculator
 
Spf chapter 03 WinForm
Spf chapter 03 WinFormSpf chapter 03 WinForm
Spf chapter 03 WinForm
 
Windows Forms For Beginners Part - 4
Windows Forms For Beginners Part - 4Windows Forms For Beginners Part - 4
Windows Forms For Beginners Part - 4
 
Ppt shortcut keys
Ppt shortcut keysPpt shortcut keys
Ppt shortcut keys
 
Maliram poonia project
Maliram poonia projectMaliram poonia project
Maliram poonia project
 

Similar to VB Module III: Dialog Boxes, Timers, Arrays and Menus

VB PPT by ADI PART4.pdf
VB PPT by ADI PART4.pdfVB PPT by ADI PART4.pdf
VB PPT by ADI PART4.pdfAdiseshaK
 
Vb6 ch.7-3 cci
Vb6 ch.7-3 cciVb6 ch.7-3 cci
Vb6 ch.7-3 cciFahim Khan
 
c programming 109.docx
c programming 109.docxc programming 109.docx
c programming 109.docxwrite31
 
ITS-16163-Module 8-Graphic User Interface (GUI)
ITS-16163-Module 8-Graphic User Interface (GUI)ITS-16163-Module 8-Graphic User Interface (GUI)
ITS-16163-Module 8-Graphic User Interface (GUI)oudesign
 
The visual studio start page is shown in the figure below
The visual studio start page is shown in the figure belowThe visual studio start page is shown in the figure below
The visual studio start page is shown in the figure belowTan Ps
 
Debugger Of Turbo C
Debugger Of Turbo CDebugger Of Turbo C
Debugger Of Turbo Cmohit2501
 
How to use a spreadsheet
How to use a spreadsheetHow to use a spreadsheet
How to use a spreadsheetSwarnima Tiwari
 
Create formsexcel
Create formsexcelCreate formsexcel
Create formsexcelRavi Gajul
 
Autodesk maya 2016 basic guide
Autodesk maya 2016 basic guideAutodesk maya 2016 basic guide
Autodesk maya 2016 basic guideĐỗ Hải
 
Introduction to Excel
Introduction to ExcelIntroduction to Excel
Introduction to ExcelNajma Alam
 

Similar to VB Module III: Dialog Boxes, Timers, Arrays and Menus (20)

Chapter 02
Chapter 02Chapter 02
Chapter 02
 
Windowforms controls c#
Windowforms controls c#Windowforms controls c#
Windowforms controls c#
 
VB PPT by ADI PART4.pdf
VB PPT by ADI PART4.pdfVB PPT by ADI PART4.pdf
VB PPT by ADI PART4.pdf
 
VB PPT by ADI PART4.pdf
VB PPT by ADI PART4.pdfVB PPT by ADI PART4.pdf
VB PPT by ADI PART4.pdf
 
Vb6 ch.7-3 cci
Vb6 ch.7-3 cciVb6 ch.7-3 cci
Vb6 ch.7-3 cci
 
c programming 109.docx
c programming 109.docxc programming 109.docx
c programming 109.docx
 
01.excell basics
01.excell basics01.excell basics
01.excell basics
 
ITS-16163-Module 8-Graphic User Interface (GUI)
ITS-16163-Module 8-Graphic User Interface (GUI)ITS-16163-Module 8-Graphic User Interface (GUI)
ITS-16163-Module 8-Graphic User Interface (GUI)
 
The visual studio start page is shown in the figure below
The visual studio start page is shown in the figure belowThe visual studio start page is shown in the figure below
The visual studio start page is shown in the figure below
 
Ma3696 Lecture 2
Ma3696 Lecture 2Ma3696 Lecture 2
Ma3696 Lecture 2
 
Vb
VbVb
Vb
 
Debugger Of Turbo C
Debugger Of Turbo CDebugger Of Turbo C
Debugger Of Turbo C
 
Excel mod 5 PowerPoint
Excel mod 5 PowerPointExcel mod 5 PowerPoint
Excel mod 5 PowerPoint
 
GUI -THESIS123
GUI -THESIS123GUI -THESIS123
GUI -THESIS123
 
How to use a spreadsheet
How to use a spreadsheetHow to use a spreadsheet
How to use a spreadsheet
 
Create formsexcel
Create formsexcelCreate formsexcel
Create formsexcel
 
Autodesk maya 2016 basic guide
Autodesk maya 2016 basic guideAutodesk maya 2016 basic guide
Autodesk maya 2016 basic guide
 
Introduction to Excel
Introduction to ExcelIntroduction to Excel
Introduction to Excel
 
excell.pdf
excell.pdfexcell.pdf
excell.pdf
 
Chapter 05
Chapter 05Chapter 05
Chapter 05
 

Recently uploaded

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 

Recently uploaded (20)

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 

VB Module III: Dialog Boxes, Timers, Arrays and Menus

  • 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")
  • 7.
  • 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)