Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 3 (ctd) Section 3.2 EVENTS. Three stages in the creation of a Visual Basic program: zCreate the interface yie, choose & create the objects zSet.

Similar presentations


Presentation on theme: "Chapter 3 (ctd) Section 3.2 EVENTS. Three stages in the creation of a Visual Basic program: zCreate the interface yie, choose & create the objects zSet."— Presentation transcript:

1 Chapter 3 (ctd) Section 3.2 EVENTS

2 Three stages in the creation of a Visual Basic program: zCreate the interface yie, choose & create the objects zSet the objects’ properties yuse the properties window of each object zCreate the code to respond to a user’s interaction with the objects zExamplesExamples

3 Responding to events zWe can write code to respond to user’s actions. zA user’s actions are called events. zEvent-driven programs are ones in which specific groups (or modules) of statements are executed on the basis of what the user does. zIn this section, we focus on statements that respond to a user’s actions by changing the properties of objects.

4 Basic features of an event procedure zFirst, invoke the window of an object by double-clicking on the object. double-clicking zFormat: Private Sub ObjectName_Event() Visual Basic code goes here End Sub Private Sub ObjectName_Event() Visual Basic code goes here End Sub

5 ExampleExample from text, pp. 60-64 zNote the interface for the example: ObjectProperty Setting WalkthroughCaption Demonstration txtPhraseText (blank) cmdBoldCaption Make Phrase Bold zLet’s create it

6 zThe text box txtPhrase has 2 events written for it: ytxtPhrase_LostFocus ytxtPhrase_GotFocus zThe command button cmdButton has 1 event written for it: ycmdBold_Click

7 Lab Assignment (Lab2) zCreate the forms, objects & events for p. 69: 38, 39, 40 Due today!

8 Homework Assignment (HW2) zDue next Tuesday zPage 70, #46, #47.


Download ppt "Chapter 3 (ctd) Section 3.2 EVENTS. Three stages in the creation of a Visual Basic program: zCreate the interface yie, choose & create the objects zSet."

Similar presentations


Ads by Google