Saturday, September 11, 2010

VB Help (Basic)

Common Controls and their properties

Some controls are used more often than others. The form is the most basic control. It is
the container in which you place all the other controls. It is also what your user will see.
The most important properties you will set for a form are its name (What the computer
will call it); its caption (What appears in the title bar that the user will see), and its back
color (what color do you want the background to be). You may also wish to set its border
style (this determines if it can be resized by the user or not). Below are listed some other
common controls and the properties you will be most concerned with:

Text box: This control allows the end user to enter data. You will want to set its name
(What the computer will call it), its text (the default text that initially appears when you
run the program), and possibly its font if you wish a different font in the text box. You
can also enter something into the text property as a default text. Finally you may want to
set its max length property. This determines the maximum number of characters a user
can type into the text box. You can also set its password character property to denote a
symbol to show in lieu of passwords. The multi-line and scroll bar properties allow you
to have a text box that can handle several lines of text.
Label: Labels are used to display information to the end user, but the end user cannot
change any information in the label. The properties you will set in this control are the
name (What the computer will call it), its caption (what will the user see), and its font.
Command Button: Command buttons allow the user to click a button. A lot of the code
that you write will be associated with command buttons. The properties you are most
interested in are: its name (What the computer will call it), its caption (What the user will
see), its style (Will your button have a text caption or a picture, if you choose the
graphical style you must set the caption equal to nothing and select a picture in the
picture property) , and its font.
List Box: A list box simply allows you to list items for a user to select from. The
property you are concerned with is the font. The items are listed using code and will be
discussed later.
Combo Box: This is like a list box but you can set more options.
Picture box: Using this control you can place any bitmap (*.bmp), Windows MetaFile
(*.wmf), or icon (*.ico) on your form. Starting with Visual Basic Version 5.0 you can
also add in JPEG (*.jpg) and GIF (*.gif) image files. All you do is set the stretch
property to true (that ensures that the picture you insert will be the size of your picture
box) and then use the picture property to select the picture you want to use.
Frame: A frame is basically a container control. It is used to group other controls. The
property you will use most with it is its caption.
Font: Many controls have a font property that lets you select the font for that control.