Datasheet
P1: GIG
WY006-01 WY006-Sample WY006-Sample-v3.cls January 29, 2004 17:49
Chapter 1
Notice how, out of the eight sizing handles surrounding the control, only two are shown in white. By
default, the TextBox control cannot be made any taller than the absolute height necessary to contain the
font that it will use to draw the text.
6. In the bottom left corner of the form, add a Button control in exactly the same manner as you
added the label and textbox. Set its Name property to btnOK, and its Text property to & OK.
Your form should now look similar to the one shown in Figure 1-17.
The ampersand (& ) is used in the Text property of buttons 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-17) 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 to the user until they press 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-17
7. Now add a second Button control to the bottom right corner of the form and set the Name
property to btnExit and the Text property to E&xit. Your form should look similar to Figure 1-18.
Now before you finish your sample application, let us briefly discuss some coding practices that you
should be using.
Modified Hungarian Notation
You may have noticed that the names given to the controls look a little funny. Each name is prefixed with
a shorthand identifier describing the type of control it is. This makes it much easier to understand what
type of control you are working with when you are looking through the code. For example, say you had a
control called simply Name, without a prefix of lbl or txt, you would not know whether you were
working with a textbox that accepted a name or a label that displayed a name. Imagine if, in the previous
26