19.12.2012 Views

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

32 <strong>Computer</strong> <strong>Programming</strong> <strong>Concepts</strong> <strong>and</strong> <strong>Visual</strong> <strong>Basic</strong><br />

FIGURE 2-20 The Three Event Procedures<br />

10. Now run the program by pressing F5.<br />

11. Type something into the text box. In Figure 2-21, the words “Hello Friend” have<br />

been typed. (A text box has the focus whenever it is ready to accept typing; that<br />

is, whenever it contains a blinking cursor.)<br />

FIGURE 2-21 Text Box Containing Input<br />

12. Press the Tab key. The contents of the text box will be enlarged as in Figure 2-<br />

22. When Tab was pressed, the text box lost the focus; that is, the event Lost-<br />

Focus happened to txtPhrase. Thus, the event procedure txtPhrase_ LostFocus<br />

was called, <strong>and</strong> the code inside the procedure was executed.<br />

FIGURE 2-22 Text Box After It Has Lost the Focus<br />

13. Click on the comm<strong>and</strong> button. This calls the event procedure cmd Bold_Click,<br />

which converts the text to boldface. See Figure 2-23.<br />

FIGURE 2-23 Text Box After the Comm<strong>and</strong> Button Has Been Clicked

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!