SlideShare a Scribd company logo
1 of 37
Hello!
I am Ma. Wennilou Porazo
Instructor
1
An
Introduction
to Visual
Basic
After studying Lesson B, you should
be able to:
● Add a VB control to a form
● Set the properties of a label, picture box, and button
control
● Select multiple controls on the form
● Format multiple VB controls simultaneously
● Open the Project Designer window
3
(cont.)
● Start and end an application
● Enter code in the Code Editor window
● Terminate an application using the Me.Close()
instruction
● Run the project’s executable file
4
Toolbox Window
● Class
○ A pattern form which an object is created
● Object
○ An instance of a class with particular setting
behaviors and attributes
5
● Toolbox Window or toolbox
○ Contains component tools for designing a
user in
○ Each tool represents a clas
○ VB Controls are instantiated using tools
6
● VB Controls
● -VB GUI objects that appear on a form.
7
8
The Label Tool
● Used to create a label control
○ Displays text that cannot be edited at run
time
● Important Properties
● Name Property
○ A unique name for control
9
Continuation……….
● Text Property
○ Specifies the value that appears in a label
control
● Location Property
○ Specifies the location of a control on a form
○ Includes an X value and a Y value
10
11
Changing a Property For Multiple
Controls
● A control inherits the font attribute of the
form.
○ You may want to change the default values
12
(cont.)
● To simultaneously modify similar controls:
○ Click one control and then press and hold
the Ctrl key
○ Click other similar control(s) in the form, or
click and drag to group the controls
○ Set the property value in the Properties list
13
14
Picture Box Tool
Button Tool
● Used to create a button control
○ Used to perform an action when clicked
○ Examples: OK and Cancel buttons
● Common means of exiting a Windows application:
○ Exit option on the FILE menu
○ Exit button
15
Starting and Ending an Application
● Startup form
○ Displays when an application is first started
● The Project Designer window specifies the
startup form or the executable code to be run
○ Right-click My Project in the Solution
Explorer window and then click Open
16
Continuation
○ Or, click PROJECT on the menu bar and
then click <project name> Properties
● Application tab
○ Specify startup form
17
Starting and Ending Application
18
Starting and Ending Application
● Executable file
● A file that can be run outside of the IDE
● Its filename ends with .exe
● It is automatically created when a Visual Basic
application is started.
19
Starting and Ending Application (cont.)
● Two ways to start an application in the IDE:
○ Click DEBUG on the menu bar and then click
Start Debugging
○ Press F5 key
20
Code Editor Window
● Events
○ User actions such as click, right-click, mouse-
over,
● Event procedure
○ A set of program instructions that are
processed when an event occurs
21
Code Editor Window (cont.)
● Code Editor window
○ Provides templates for creating event
procedures
○ To open it, right-click the form and then click
View Code
22
23
Code Editor window opened in the IDE
Code Editor Window (cont.)
● Class Name list box
○ Lists names of objects (VB controls) included
in the user interface.
● Method Name list box
○ Lists appropriate events for the selected
object
24
Code Editor Window (cont.)
● To select a VB control’s event in the Code Editor
window
○ Select the class name first
○ Then select the method name
● Syntax
○ The rules of a programming language
25
26
Code collapsed in the Code Editor Window
Writing a Procedure
● Procedure header
○ The first line in the code template for an
event procedure
● Procedure footer
○ The last line in the code template for an event
procedure
27
Writing a Procedure
● Keyword
○ A word that has a special meaning in a programming
language
○ Color coded in the IDE
28
29
Event Sub Procedure
● Sub procedure
A block of code that performs a specific task
● Keywords in a sub procedure block:
○ Sub: Starts a sub procedure
○ End Sub: Indicates the end of a sub procedure
○ Private: Restricts the use of the procedure to the
form where it appears.
30
Event Sub Procedure
• The names of event sub procedure include the
object (VB control) name and event name
Example: btnExit_Click
31
Me. Close () Instruction and IntelliSense
● Method
○ A predefined procedure
○ Can be called or invoked when needed
● Me.Close() method
○ Causes the current form to close
○ If it is only form in an application, the application
terminates
32
Me. Close () Instruction and IntelliSense
● Intellisense feature
○ Provides appropriate selections as pop-up lists
when coding
○ Type the first few letters of your choice
○ Then use the arrow keys to select an item in the
list
33
34
List displayed by the IntelliSense feature
Lesson B, Summary
● To add a control to a form, use a tool from the
toolbox
● Use the label control for text that users cannot
edit
● You can set the properties of multiple controls
simultaneously
35
Lesson B, Summary (cont.)
● To start and stop an application in the IDE, use
DEBUG on the menu bar
● Use the Code Editor window to display an
object’s event procedures
● The Me.Close() method closes the current form
at run time
36
Thanks!
37

More Related Content

Similar to CHAPTER 1: Lesson B

Similar to CHAPTER 1: Lesson B (20)

vb.pptx
vb.pptxvb.pptx
vb.pptx
 
vb-160518151614.pdf
vb-160518151614.pdfvb-160518151614.pdf
vb-160518151614.pdf
 
vb-160518151614.pptx
vb-160518151614.pptxvb-160518151614.pptx
vb-160518151614.pptx
 
CHAPTER 3 - LESSON C
CHAPTER 3 - LESSON CCHAPTER 3 - LESSON C
CHAPTER 3 - LESSON C
 
Visual basic
Visual basicVisual basic
Visual basic
 
Introduction to Visual Basic (Week 2)
Introduction to Visual Basic (Week 2)Introduction to Visual Basic (Week 2)
Introduction to Visual Basic (Week 2)
 
Intake 37 9
Intake 37 9Intake 37 9
Intake 37 9
 
Spf chapter 03 WinForm
Spf chapter 03 WinFormSpf chapter 03 WinForm
Spf chapter 03 WinForm
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0
 
Intake 38 9
Intake 38 9Intake 38 9
Intake 38 9
 
Chapter 03 - Program Coding and Design
Chapter 03 - Program Coding and DesignChapter 03 - Program Coding and Design
Chapter 03 - Program Coding and Design
 
Chapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface DesignChapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface Design
 
COSC 1436 Project Page 1 Pre Project Example Secti.docx
COSC 1436 Project Page 1  Pre Project Example Secti.docxCOSC 1436 Project Page 1  Pre Project Example Secti.docx
COSC 1436 Project Page 1 Pre Project Example Secti.docx
 
SPF WinForm Programs
SPF WinForm ProgramsSPF WinForm Programs
SPF WinForm Programs
 
COM 211 PRESENTATION.pptx
COM 211 PRESENTATION.pptxCOM 211 PRESENTATION.pptx
COM 211 PRESENTATION.pptx
 
W1.pptx
W1.pptxW1.pptx
W1.pptx
 
Chapter 2: LESSON A
Chapter 2: LESSON AChapter 2: LESSON A
Chapter 2: LESSON A
 
Introduction
IntroductionIntroduction
Introduction
 
Vb.net ide
Vb.net ideVb.net ide
Vb.net ide
 
VB.NET programming
VB.NET programmingVB.NET programming
VB.NET programming
 

More from MLG College of Learning, Inc (20)

PC111.Lesson2
PC111.Lesson2PC111.Lesson2
PC111.Lesson2
 
PC111.Lesson1
PC111.Lesson1PC111.Lesson1
PC111.Lesson1
 
PC111-lesson1.pptx
PC111-lesson1.pptxPC111-lesson1.pptx
PC111-lesson1.pptx
 
PC LEESOON 6.pptx
PC LEESOON 6.pptxPC LEESOON 6.pptx
PC LEESOON 6.pptx
 
PC 106 PPT-09.pptx
PC 106 PPT-09.pptxPC 106 PPT-09.pptx
PC 106 PPT-09.pptx
 
PC 106 PPT-07
PC 106 PPT-07PC 106 PPT-07
PC 106 PPT-07
 
PC 106 PPT-01
PC 106 PPT-01PC 106 PPT-01
PC 106 PPT-01
 
PC 106 PPT-06
PC 106 PPT-06PC 106 PPT-06
PC 106 PPT-06
 
PC 106 PPT-05
PC 106 PPT-05PC 106 PPT-05
PC 106 PPT-05
 
PC 106 Slide 04
PC 106 Slide 04PC 106 Slide 04
PC 106 Slide 04
 
PC 106 Slide no.02
PC 106 Slide no.02PC 106 Slide no.02
PC 106 Slide no.02
 
pc-106-slide-3
pc-106-slide-3pc-106-slide-3
pc-106-slide-3
 
PC 106 Slide 2
PC 106 Slide 2PC 106 Slide 2
PC 106 Slide 2
 
PC 106 Slide 1.pptx
PC 106 Slide 1.pptxPC 106 Slide 1.pptx
PC 106 Slide 1.pptx
 
Db2 characteristics of db ms
Db2 characteristics of db msDb2 characteristics of db ms
Db2 characteristics of db ms
 
Db1 introduction
Db1 introductionDb1 introduction
Db1 introduction
 
Lesson 3.2
Lesson 3.2Lesson 3.2
Lesson 3.2
 
Lesson 3.1
Lesson 3.1Lesson 3.1
Lesson 3.1
 
Lesson 1.6
Lesson 1.6Lesson 1.6
Lesson 1.6
 
Lesson 3.2
Lesson 3.2Lesson 3.2
Lesson 3.2
 

Recently uploaded

HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 

Recently uploaded (20)

Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 

CHAPTER 1: Lesson B

  • 1. Hello! I am Ma. Wennilou Porazo Instructor 1
  • 3. After studying Lesson B, you should be able to: ● Add a VB control to a form ● Set the properties of a label, picture box, and button control ● Select multiple controls on the form ● Format multiple VB controls simultaneously ● Open the Project Designer window 3
  • 4. (cont.) ● Start and end an application ● Enter code in the Code Editor window ● Terminate an application using the Me.Close() instruction ● Run the project’s executable file 4
  • 5. Toolbox Window ● Class ○ A pattern form which an object is created ● Object ○ An instance of a class with particular setting behaviors and attributes 5
  • 6. ● Toolbox Window or toolbox ○ Contains component tools for designing a user in ○ Each tool represents a clas ○ VB Controls are instantiated using tools 6
  • 7. ● VB Controls ● -VB GUI objects that appear on a form. 7
  • 8. 8
  • 9. The Label Tool ● Used to create a label control ○ Displays text that cannot be edited at run time ● Important Properties ● Name Property ○ A unique name for control 9
  • 10. Continuation………. ● Text Property ○ Specifies the value that appears in a label control ● Location Property ○ Specifies the location of a control on a form ○ Includes an X value and a Y value 10
  • 11. 11
  • 12. Changing a Property For Multiple Controls ● A control inherits the font attribute of the form. ○ You may want to change the default values 12
  • 13. (cont.) ● To simultaneously modify similar controls: ○ Click one control and then press and hold the Ctrl key ○ Click other similar control(s) in the form, or click and drag to group the controls ○ Set the property value in the Properties list 13
  • 15. Button Tool ● Used to create a button control ○ Used to perform an action when clicked ○ Examples: OK and Cancel buttons ● Common means of exiting a Windows application: ○ Exit option on the FILE menu ○ Exit button 15
  • 16. Starting and Ending an Application ● Startup form ○ Displays when an application is first started ● The Project Designer window specifies the startup form or the executable code to be run ○ Right-click My Project in the Solution Explorer window and then click Open 16
  • 17. Continuation ○ Or, click PROJECT on the menu bar and then click <project name> Properties ● Application tab ○ Specify startup form 17
  • 18. Starting and Ending Application 18
  • 19. Starting and Ending Application ● Executable file ● A file that can be run outside of the IDE ● Its filename ends with .exe ● It is automatically created when a Visual Basic application is started. 19
  • 20. Starting and Ending Application (cont.) ● Two ways to start an application in the IDE: ○ Click DEBUG on the menu bar and then click Start Debugging ○ Press F5 key 20
  • 21. Code Editor Window ● Events ○ User actions such as click, right-click, mouse- over, ● Event procedure ○ A set of program instructions that are processed when an event occurs 21
  • 22. Code Editor Window (cont.) ● Code Editor window ○ Provides templates for creating event procedures ○ To open it, right-click the form and then click View Code 22
  • 23. 23 Code Editor window opened in the IDE
  • 24. Code Editor Window (cont.) ● Class Name list box ○ Lists names of objects (VB controls) included in the user interface. ● Method Name list box ○ Lists appropriate events for the selected object 24
  • 25. Code Editor Window (cont.) ● To select a VB control’s event in the Code Editor window ○ Select the class name first ○ Then select the method name ● Syntax ○ The rules of a programming language 25
  • 26. 26 Code collapsed in the Code Editor Window
  • 27. Writing a Procedure ● Procedure header ○ The first line in the code template for an event procedure ● Procedure footer ○ The last line in the code template for an event procedure 27
  • 28. Writing a Procedure ● Keyword ○ A word that has a special meaning in a programming language ○ Color coded in the IDE 28
  • 29. 29
  • 30. Event Sub Procedure ● Sub procedure A block of code that performs a specific task ● Keywords in a sub procedure block: ○ Sub: Starts a sub procedure ○ End Sub: Indicates the end of a sub procedure ○ Private: Restricts the use of the procedure to the form where it appears. 30
  • 31. Event Sub Procedure • The names of event sub procedure include the object (VB control) name and event name Example: btnExit_Click 31
  • 32. Me. Close () Instruction and IntelliSense ● Method ○ A predefined procedure ○ Can be called or invoked when needed ● Me.Close() method ○ Causes the current form to close ○ If it is only form in an application, the application terminates 32
  • 33. Me. Close () Instruction and IntelliSense ● Intellisense feature ○ Provides appropriate selections as pop-up lists when coding ○ Type the first few letters of your choice ○ Then use the arrow keys to select an item in the list 33
  • 34. 34 List displayed by the IntelliSense feature
  • 35. Lesson B, Summary ● To add a control to a form, use a tool from the toolbox ● Use the label control for text that users cannot edit ● You can set the properties of multiple controls simultaneously 35
  • 36. Lesson B, Summary (cont.) ● To start and stop an application in the IDE, use DEBUG on the menu bar ● Use the Code Editor window to display an object’s event procedures ● The Me.Close() method closes the current form at run time 36