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

DOCX
Alok photoshop 2
PDF
Excel 2007 keyboard shortcut
PDF
Microsoft excel-2003-keyboard-shortcuts
DOC
Gui testing
PPTX
02.modifying worksheet
PPTX
Vs c# lecture1
PPT
06 win forms
Alok photoshop 2
Excel 2007 keyboard shortcut
Microsoft excel-2003-keyboard-shortcuts
Gui testing
02.modifying worksheet
Vs c# lecture1
06 win forms

What's hot (17)

DOCX
Excel short cut keys and tips remaining
PPTX
Vs c# lecture3
PDF
Excel shortcuts
PDF
PPTX
Vs c# lecture5
PDF
100 keyboard shortcuts for windows 8
PPT
Excel for beginners class 3
PDF
Excel Shortcuts
PPS
see how share price calculated in pre-opening session..MUST WATCH
PDF
2 front panel
DOCX
Open Office Calc : Level 1
PDF
Windows Forms For Beginners Part - 1
PPT
Graphing Calculator
PPTX
Spf chapter 03 WinForm
PDF
Windows Forms For Beginners Part - 4
PDF
Ppt shortcut keys
DOCX
Excel short cut keys and tips remaining
Vs c# lecture3
Excel shortcuts
Vs c# lecture5
100 keyboard shortcuts for windows 8
Excel for beginners class 3
Excel Shortcuts
see how share price calculated in pre-opening session..MUST WATCH
2 front panel
Open Office Calc : Level 1
Windows Forms For Beginners Part - 1
Graphing Calculator
Spf chapter 03 WinForm
Windows Forms For Beginners Part - 4
Ppt shortcut keys
Ad

Similar to Module iii part i (20)

PPT
Chapter 02
PPTX
Windowforms controls c#
PDF
VB PPT by ADI PART4.pdf
PDF
VB PPT by ADI PART4.pdf
PDF
Vb6 ch.7-3 cci
DOCX
c programming 109.docx
PPTX
01.excell basics
PPTX
ITS-16163-Module 8-Graphic User Interface (GUI)
DOCX
The visual studio start page is shown in the figure below
PDF
Ma3696 Lecture 2
PPTX
Debugger Of Turbo C
PPTX
Excel mod 5 PowerPoint
PPT
GUI -THESIS123
PPTX
How to use a spreadsheet
PDF
Create formsexcel
PDF
Autodesk maya 2016 basic guide
PPTX
DOC-20230724-WA0011..pptxyffhjingtrfhiijh
PDF
excell.pdf
PPT
Introduction to Excel
Chapter 02
Windowforms controls c#
VB PPT by ADI PART4.pdf
VB PPT by ADI PART4.pdf
Vb6 ch.7-3 cci
c programming 109.docx
01.excell basics
ITS-16163-Module 8-Graphic User Interface (GUI)
The visual studio start page is shown in the figure below
Ma3696 Lecture 2
Debugger Of Turbo C
Excel mod 5 PowerPoint
GUI -THESIS123
How to use a spreadsheet
Create formsexcel
Autodesk maya 2016 basic guide
DOC-20230724-WA0011..pptxyffhjingtrfhiijh
excell.pdf
Introduction to Excel
Ad

Recently uploaded (20)

PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Classroom Observation Tools for Teachers
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Complications of Minimal Access Surgery at WLH
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
master seminar digital applications in india
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
Cell Structure & Organelles in detailed.
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Supply Chain Operations Speaking Notes -ICLT Program
Classroom Observation Tools for Teachers
Week 4 Term 3 Study Techniques revisited.pptx
O5-L3 Freight Transport Ops (International) V1.pdf
Complications of Minimal Access Surgery at WLH
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
O7-L3 Supply Chain Operations - ICLT Program
master seminar digital applications in india
Pharma ospi slides which help in ospi learning
Renaissance Architecture: A Journey from Faith to Humanism
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Cell Structure & Organelles in detailed.
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
3rd Neelam Sanjeevareddy Memorial Lecture.pdf

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)