Datasheet

18
Chapter 1
Control Prefix
Button btn
ComboBox cbo
CheckBox chk
Label lbl
ListBox lst
MainMenu mnu
RadioButton rdb
PictureBox pic
TextBox txt
The Code Editor
Now that you have the HelloUser form defined, you have to add some code to make it actually do
something interesting. You have already seen how easy it is to add controls to a form. Providing the
functionality behind those on-screen elements is no more difficult. To add the code for a control, you
just double-click the control in question. This will open the code editor in the main window, shown
in Figure 1-17.
Figure 1-17
Notice that an additional tab has been created in the main window. Now you have the Design tab and
the Code tab. You draw the controls on your form in the Design tab, and you write code for your form in
the Code tab. One thing to note here is that Visual Studio 2005 has created a separate file for the code.
The visual definition and the code behind exist in separate files:
HelloUser.Designer.vb and Hello
User.vb
. This is actually the reason why building applications with Visual Basic 2005 is so slick and
easy. Using the Design view you can visually lay out your application, and then, using Code view, you
add just the bits of code to implement your desired functionality.
You will also notice that there are two combo boxes at the top of the window. These provide shortcuts to
the various parts of your code. Hover your mouse on the combo box on the left, and you’ll see a ToolTip
appear, telling you that it is the Class Name combo box. If you expand this combo box, you will see a list
04_574019 ch01.qxd 9/16/05 9:43 PM Page 18