Datasheet

The ampersand (&) is used in the Text property of buttons is to create a keyboard shortcut (known as a
hot key). The letter with the & sign placed in front of it will become underlined (as shown in Figure
1-14) to signal users that they can select that button by pressing the Alt+letter key combination, instead
of using the mouse (on some configurations the underline doesn’t appear until the user presses Alt). In
this particular instance, pressing Alt+O would be the same as clicking directly on the OK button. There
is no need to write code to accomplish this.
Figure 1-14
7. Now add a second Button control to the bottom right corner of the form by dragging the Button
control from the Toolbox onto your form. You’ll notice that, as you get close to the bottom right
of the form, a blue snap line will appear, as shown in Figure 1-15. This snap line will allow you
to align this new Button control with the existing Button control on the form. The snap lines
assist you in aligning controls to the left, right, top, or bottom of each other, depending on
where you are trying to position the new control. The light blue line provides you with a consis-
tent margin between the edge of your control and the edge of the form. Set the Name property
to btnExit and the Text property to E&xit. Your form should look similar to Figure 1-16.
Figure 1-15
16
Chapter 1
04_574019 ch01.qxd 9/16/05 9:43 PM Page 16