Fundamentals of Programming in Visual Basic (VB):在Visual Basic编程基础(VB).ppt
Fundamentals of Programming in Visual Basic (VB) Visual Basic Events Simple Statement 1 Chapter 3 Event An event is an action, such as the user clicking on a button Usually, nothing happens in a Visual Basic program until the user does something and generates an event. What happens is determined by statements. Visual Basic Events 2 Chapter 3 Assignment Statements Assign a value to a property. General Form: source = value A value on the right-hand side of = is assigned to the left-hand size of =. 3 Chapter 3 Sample Statements = = True = “Hello World” General Form: = setting Value represented by setting is stored into Color is a structure allowing us to specify various colors 4 Chapter 3 Lab Refers to the examples in the Lab 5 Chapter 3 Sample Form txtFirst txtSecond btnRed 6 Chapter 3 Focus When you click on a text box, a cursor appears in the text box, and you can type into the text box. Such a text box is said to have the focus. If you click on another text box, the first text box loses the focus and the second text box receives the focus. 7 Chapter 3 Examples of Events
General Form:
This event occurs when a mouse is clicked on the button btnShow This event occurs when user changes the text of txtBox This event occurs when the input focus leaves txtBox 8 Chapter 3 The three steps in creating a Visual Basic program: Create the interface; that is, generate, position, and size the objects. Set properties; that is, configure the appearance of the objects. Write the code that executes when events occur. 9 Chapter 3 Code Window Method Name box Class Name box Page tab Page tab: 1. is a code window 2. [design] is a design window (to manipulate the window appearance) 10 Chapter 3
Fundamentals of Programming in Visual Basic (VB):在Visual Basic编程基础(VB) 来自淘豆网www.taodocs.com转载请标明出处.