SlideShare a Scribd company logo
Hello!
I am Ma. Wennilou Porazo
1
The
Selection
Structure
After studying Lesson C, you should
be able to:
● Prevent the entry of unwanted characters in a text.
● Select the existing text in a textbox.
3
Coding the KeyPress Event Procedures
4
Coding the KeyPress Event Procedures
(cont.)
5
Coding the Enter Event Procedures
6
Coding the KeyPress Event Procedures
(cont.)
7
Coding the KeyPress Event
Procedures (cont.)
8
9
10
Lesson C, Summary:
● The KeyPress event occurs when the user
presses a key.
● Use the KeyPress event to cancel an unwanted
key pressed by the user.
● Use the SelectAll method to select all contents of
a text box.
11
Lesson C, Summary (cont.)
● The Enter event occurs when the textbox
receives the focus.
● Use the Enter event to process code when the
control receives the focus.
12
Lesson C, Summary (cont.
● To allow a text box to accept only certain keys:
○ Code the text box’s KeyPress event procedure. Th
e key the user pressed is stored in the e.KeyChar
property. You use the e.Handled = True
instruction to cancel the key pressed by the user.
13
Lesson C, Summary (cont.)
● To select the existing text in a text box:
○ Use the SelectAll method. Th e method’s syntax is
textbox.SelectAll().
● To process code when a control receives the focus:
○ Enter the code in the control’s Enter event
procedure
14
Reference
● Book
○ Programming with Microsoft Visual Basic
2010, 5th edition
○ Author: Diane Zak
15
Thanks!
16

More Related Content

PDF
How to Install Fonts in Photoshop
PDF
Unit testing in PHP
PPTX
PPTX
PC111-lesson1.pptx
PPTX
PC LEESOON 6.pptx
PPTX
PC 106 PPT-09.pptx
PPTX
How to Install Fonts in Photoshop
Unit testing in PHP
PC111-lesson1.pptx
PC LEESOON 6.pptx
PC 106 PPT-09.pptx

More from MLG College of Learning, Inc (20)

PPTX
PPTX
PPTX
PC 106 Slide no.02
PPTX
PPTX
PPTX
PC 106 Slide 1.pptx
PDF
Db2 characteristics of db ms
PDF
PPTX
How to install windows 7 operating system
PPTX
Hardware tools modified
PPTX
Lesson 6 php if...else...elseif statements
PPTX
Lesson 5 php operators
PC 106 Slide no.02
PC 106 Slide 1.pptx
Db2 characteristics of db ms
How to install windows 7 operating system
Hardware tools modified
Lesson 6 php if...else...elseif statements
Lesson 5 php operators
Ad

Recently uploaded (20)

PPTX
GDM (1) (1).pptx small presentation for students
PDF
Complications of Minimal Access Surgery at WLH
PDF
01-Introduction-to-Information-Management.pdf
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Classroom Observation Tools for Teachers
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
Pharma ospi slides which help in ospi learning
PDF
Anesthesia in Laparoscopic Surgery in India
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PPTX
Cell Types and Its function , kingdom of life
PDF
Trump Administration's workforce development strategy
GDM (1) (1).pptx small presentation for students
Complications of Minimal Access Surgery at WLH
01-Introduction-to-Information-Management.pdf
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
human mycosis Human fungal infections are called human mycosis..pptx
FourierSeries-QuestionsWithAnswers(Part-A).pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Classroom Observation Tools for Teachers
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Pharma ospi slides which help in ospi learning
Anesthesia in Laparoscopic Surgery in India
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
VCE English Exam - Section C Student Revision Booklet
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Cell Types and Its function , kingdom of life
Trump Administration's workforce development strategy
Ad

CHAPTER 4- Lesson C

  • 1. Hello! I am Ma. Wennilou Porazo 1
  • 3. After studying Lesson C, you should be able to: ● Prevent the entry of unwanted characters in a text. ● Select the existing text in a textbox. 3
  • 4. Coding the KeyPress Event Procedures 4
  • 5. Coding the KeyPress Event Procedures (cont.) 5
  • 6. Coding the Enter Event Procedures 6
  • 7. Coding the KeyPress Event Procedures (cont.) 7
  • 8. Coding the KeyPress Event Procedures (cont.) 8
  • 9. 9
  • 10. 10
  • 11. Lesson C, Summary: ● The KeyPress event occurs when the user presses a key. ● Use the KeyPress event to cancel an unwanted key pressed by the user. ● Use the SelectAll method to select all contents of a text box. 11
  • 12. Lesson C, Summary (cont.) ● The Enter event occurs when the textbox receives the focus. ● Use the Enter event to process code when the control receives the focus. 12
  • 13. Lesson C, Summary (cont. ● To allow a text box to accept only certain keys: ○ Code the text box’s KeyPress event procedure. Th e key the user pressed is stored in the e.KeyChar property. You use the e.Handled = True instruction to cancel the key pressed by the user. 13
  • 14. Lesson C, Summary (cont.) ● To select the existing text in a text box: ○ Use the SelectAll method. Th e method’s syntax is textbox.SelectAll(). ● To process code when a control receives the focus: ○ Enter the code in the control’s Enter event procedure 14
  • 15. Reference ● Book ○ Programming with Microsoft Visual Basic 2010, 5th edition ○ Author: Diane Zak 15