To familiarize yourself with the Toolbox run your mouse cursor over each item inside the box to get a description of what each is. These aren't all the options at your disposal, and you can add more by right-clicking on the Toolbox, selecting Components, and then choosing an object from the resulting window.

 

The Project Explorer Window is another window in the Dev. area that you should be familiar with. Microsoft changed the formal name from Project window to Project Explorer window between versions 4 and 5 of VB to celebrate the resemblance of the window to the typical Explorer hard drive navigator. You can expand and collapse branches just as you would do if you were browsing directories on your hard drive. The window contains objects such as forms, modules(a type of object containing special code), classes (an advanced module), and more. So if you have five forms in your application and would like to edit Form1, you'd find Form1 using the explorer(much like finding a file on your hard drive named Form1) and click on it twice to edit it.

 

The Properties Window contains detailed descriptions of each object within your program. If you select Form1(if the form has square boxes at each corner it is selected) and look at the window labeled Properties Window you'll have a list of editable properties. You don't have to understand what all of these do, for now just remember where you can view them.

 

This concludes the overview of the IDE and its various windows. These windows will play an important role in developing your software. Don't worry if you're still not sure about some of them , with some reading and some experimenting you'll have a good handle on the Developer Studio.

 

Getting Help in the IDE

From other programmer's websites to the ever-cluttered Microsoft homepage you can find help for Visual Basic. But if you'd like to get help the old-fashioned way, that is, not using the internet, you'll find the IDE is more than equipped to answer your questions than most websites, including this one. If you need help with a control, tool, or command, you name it, you can press F1 while selecting the object in question. This pulls up VB's help index, which is just a list of help topics in alphabetical order. Try and figure out programming problems by yourself before resorting to this resource, often you'll find a minor bug and correct it. Use it to learn new syntax. This is an priceless resource, so familiarize yourself with it, and you'll be glad you did.

This concludes the tour of the VB IDE. You've browsed all parts of the environment including the toolbox, Form window, Project Explorer window, and the Properties window, as seen in Figure 1.

 

Summary

During this chapter you were introduced to Visual Basic and its roots and purpose. This is a simple language as far as programming languages are concerned, but in no way does that make it incapable of advanced functions. You've learned that VB is similar to spoken languages, in that it has correct and incorrect syntax and grammar. You will explore this area more. In the Programming Processes section you learned the common routine of coding a program in any language. Although VB's IDE seems to blur the difference between some of those steps, making it easier for you to debug. Finally you took a tour of the development environment that you will be coding in.

 

 

 

Controls

Now we're going to cover every control in the Standard edition with the exception of the three custom control, and practically everything you can do with that control. You are already somewhat experienced with VB and know what the controls do, so match the following pictures with the name and the definition.

1.-

2.- 

3.- 

4.-

5.- 

6.-

 

 

 

 

 

 

7.- 

8.-

9.- 

10.-  

11.- 

12.-

 

 

 

 

 

 

13.- 

14.-

15.-

16.- 

17.- 

18.-

 

(    ) 

List Box

(    ) 

This is an option that can either be checked, unchecked, or grayed. They are like survey things that ask you "what magazine(s) do you read, check all that apply." Then there would be a list of magazines, and you'd put a check in front of any that fit the description. In other words, more that one can be checked at a time. The .caption property defines what you are checking. This would be the name of the magazine in our example. The .alignment property can be set to either right or left, defining where the box is in relation to the text. Most importantly, the value property defines the checkbox as being either check, unchecked, or grayed.

(    ) 

 

Frame

(    ) 

This is a simple version of a combo box. Actually, a combo box is a combination of a text box and a list box, but let's not get technical! It can do everything a combo box can do, but since it doesn't have a text box part, nothing appears to happen when you select something. However, the .text property is being set just as before.

(    ) 

Combo Box

(    ) 

This is what this control is used for. You can control the data in a database very easily and without even using code with Visual Basic simple data access features, although a little code can make all the difference!

(    ) 

Text Box

 (    ) 

You have also seen them in the Windows operating system; in dialog boxes in particular. They are used to group a series of controls together. Grouping controls can have a number of effects. First of all, the coordinate system for a control is based on it's bounding control. Don't worry, I'll interpret that into English. Every control has an x,y coordinate, x being the distance from the left and y being the distance from the top. The coordinate specifies the upper left corner of the control, and the .width and .height properties of the control define, well, the width and height. Coordinates are measured in twips, which is a unit used in GUIs. Twips are usually used instead of pixels because the screen resolution determines the size of the pixels. There are always 1440 twips in an inch. If you put a control at 0,0 in a form by itself, it's upper left corner will be at the upper left corner of the form.

(    ) 

Drive List Box

(    ) 

The drive box has a .drive property which describes the current drive displayed in the box (such as "a:" "c:" or "d:").

(    ) 

Shape

(    ) 

Here's the first advanced control we're covering. It drops down list boxes with a text entry box at the top. It displays a list of items in a list when you click the arrow on the right. There is a text box at the top which allows the user to type in stuff, and possibly add an item to the list if that's what the programmer allows.

(    ) 

Command Button

(    ) 

In a Windows program you will often see text above or to the left of a text box identifying what the purpose of that text box is. Its primary purpose is to show the user of your program what something on the form does, but it can also be used to display a message or some result calculation that is not intended to be changed by the user.

(    ) 

Data Access Control

 (    ) 

The directory list box has a .path property which describes the path of the current directory selected in the box (such as "c:\" "c:\windows" or (   "d:\windows\system"). Notice t hat when the root directory ("a:\" "c:\" or "d:\") is selected in the directory list box, a backslash comes after the drive letter, but when any other directory is selected, there is no postfixed backslash.

(    ) 

Picture Box

(    ) 

It is primarily used for displaying images (duh). Pretty much everything I say here applies to the Picture box control as well with the exception of the .Stretch property. Pictures can be loaded into visual basic, as long as they are either Windows Bitmaps (.bmp - the most common),

(    ) 

Directory List Box

(    ) 

This is a fun control. It is very simple and straightforward, and it is extremely useful. When you want code to be executed many times in regular intervals, this is an option

(    ) 

Check Box

(    ) 

We'll be using it a lot in VB programming. Command buttons are clickable options in windows like OK, CANCEL, RETRY, ABORT, FAIL, etc. When you click the button, the _Click event is generated for the control. The .caption property determine s what is displayed on the button. This is kind of a cool trick that applies to any control: when you put a & symbol in front of a letter in the .caption property, that letter is underlined. An underlined character means that the user can press ALT and that letter to click that control (or in most cases, just set the focus to it).

(    ) 

Horizontal and Vertical Scroll Bars

(    ) 

It works virtually the same way as the shape control with a couple property differences. You have the .BorderColor, .BorderStyle, and .BorderWidth properties that define the attributes for the color, style, and thickness of the line that is drawn.

(    ) 

Line Control

(    ) 

Its primary purpose is to display a method of the user typing information to the program. It can be several lines long, like a word processor form. The .text property of the text box determines it's text, which can be set at design time or run time (by the program OR the user). It is a useful control, but not very advanced. You cannot place carriage returns through code into a text box using Chr$(13), and the te xt box can only contain text of one font and color at a time.

(    ) 

Label

 (    ) 

These buttons are like check boxes, only just one of them can be enabled at a time (plus there is no grayed value for the .value property). You will want to separate it in to groups using either frames or picture boxes. They are like questions on a survey which ask you "What year of high school are you in," and the options are FRESHMAN, SOPHOMORE, JUNIOR, SENIOR, or NONE. You can't be more that one, so only one can be checked. If you have two "questions," then they should be separated into groups.

(    ) 

Radio Button

(    ) 

File list box have a .path property, and they both work the same way. In fact, you would usually put a line like flbFiles.Path = dlbDirectories.Path in the directory list box's _Change procedure.

(    ) 

File List Box

(    ) 

This control is like a form within a form. Its primary use is to display pictures, as the name implies, but it can also be used to contain other objects within a group like a frame, or to display messages. The print method can be used on the it to display text, and other controls can simply be dragged into the box while in design time to make them part of it (in a sense).

(    ) 

Timer

(    ) 

A scroll bar is a very common windows element that lets the user give input on a scale and at the same time, gives the user output on a scale. This scale is manipulated by either clicking these ones

(    ) 

Image Control

 (    ) 

This control is pretty self explanatory and simple to use. Design time graphics could probably be done without, but they provide a quick and easy way to create graphics that look good with your program, so it's an appropriate part for the purpose of the language.

 

Hosted by www.Geocities.ws

1