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.

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

10.2 NINE ELEMENTARY CONTROLS<br />

In this section, we discuss the nine controls indicated on the Toolbox in Figure 10-3.<br />

FIGURE 10-3 Nine Elementary Controls.<br />

THE FRAME CONTROL<br />

Frames are passive objects used to group related sets of controls for visual effect. You rarely<br />

write event procedures for frames. The preceding frame has a group of three text boxes attached<br />

to it. When you drag the frame, the attached controls follow as a unit. If you hide the frame,<br />

the attached controls will be hidden as well.<br />

A control must be attached to a frame in a special way. You cannot just double-click to create<br />

the control <strong>and</strong> then drag it into a frame. To attach a control to a frame, first create the frame.<br />

Next, single-click on the control icon to activate it, then move the mouse pointer inside the<br />

frame to the point where you want to place the upper-left corner of the control. Finally, drag<br />

the mouse to the right <strong>and</strong> down, <strong>and</strong> then release the mouse button when you are satisfied with<br />

the size of the control. This is referred to as the single-click-draw technique.<br />

A group of controls also can be attached to a picture box. The advantages of using<br />

frames are that they have a title sunk into their borders that can be set with the Caption property<br />

<strong>and</strong> that they cannot receive the focus. As shown later in this section, the frame control<br />

is particularly important when working with groups of option button controls. The st<strong>and</strong>ard<br />

prefix for the name of a frame is fra.<br />

THE CHECK BOX CONTROL<br />

A check box, which consists of a small square <strong>and</strong> a caption, presents the user with a yes/no<br />

choice. The form in Example 1 uses four check box controls. The Value property of a check<br />

box is 0 when the square is empty <strong>and</strong> is 1 when the square is checked. At run time, the user

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

Saved successfully!

Ooh no, something went wrong!