Your First VB Project VB Help

When you select the Standard EXE type of project in the New Project window, Visual Basic creates a new project named Project 1. Project 1 is the top item in the Project Explorer window. The Forms folder under the project name contains the. names of all Forms that make up the project. As you will see in the next chapter, a project can have more than one Form.

Renaming and Saving the Project

You should start your projects by renaming their components and saving them, preferably in a new folder. To do so, follow these steps:

1. In the Project Explorer window, click the project’s name (Projectl).
2. ,In the Properties window, select the value of the Name property  (projects have a single property, the Name property) and enter the name MVB6_1 (for Mastering Visual Basic 6).
;3. In the Project Explorer window, select the name of the Form. The Properties window now displays the Form’s properties.
4. Locate the Name property, select it, and change it to Examplel. Your Project Explorer window should now look like the one.


Now’ you are ready to save the project. To save a project, you must first save the Form(s) and then the project (more on this in Chapter 2,!n which we’ll look at the structure of a project and how it’s saved on disk). When saving projects, try to use meaningful file names so that you’ll be able to locate them later. For the projects of this book, I had to use eight-character names, a limitation imposed by the CD production process.

Follow these steps to save the project:

1. Choose File  >- Save Example As. (Visual Basic suggests the default name for the Form, so you must select the Save As command, not the Save command.)


2. In the Save File As window , click the New Folder button to create a new folder and save the project there. Each project and its files should be stored in a separate folder, but it is possible to store multiple projects in the same folder.

3. Name the new folder and click Save.

4. Choose File >- Save Project As. In the Save Project As window, enter a name for the project file and click Save.

The Elements of the User Interface

The user interlace is what appears in the application’s window when it runs. It consists of various elements with which the user can interact and control the application. The first element of the user interface is the Form. This is the window displayed at runtime, and it acts as a container for all the elements of the interface. The elements in the user interface are common to all Windows applications, and they are all shown as icons in the Toolbox.

The icons in the Toolbox of the Visual Basic IDE and their names are shown Let’s quickly run through the controls shown in the Toolbox.


Picture Box

This control is used to display images, and the images are set with the Picture property. The Picture Box control supports a number of  methods for generating drawings.


This control displays text on a Form. that the user can’t edit; Labels commonly identify other-controls and can be transparent, so the text appears to be placed directly on the Form. You set the label’s text with the Caption property.


This control displays text that the user can edit. The TextBox control is a mini text editor, and its most important property is the Text property, which can set the text on the control or read the text that the user enters.


This control is used to draw boxes on the Form and to group other elements.

Command Button

This is the most common element of the Windows interface. A Command button represents an action that is carried out when the user clicks the button.


The CheckBox control presents one or more choices that the user can select. The CheckBox control’s main property is Value, and it is 0 if the CheckBox is cleared, and 1 if the CheckBox is checked. The CheckBox is a toggle. Every time it’s clicked, it changes status (from checked to cleared and back’).

Option Button

Option buttons, or radio buttons, appear in groups, and the user can choose only one of them. The Option button’s main property is Checked, and it is True if the control is checked, and False otherwise:The Option button is a toggle. Every time it’s clicked, it changes status (from ,checked to cleared and back).


This control is similar to the ListBox control, but it contains a text Edit field. The user can either choose an item from the list or enter a new string in the Edit field. The item selected from the list (or entered in the Edit field) is given by the control’g Text property.


This control contains a list of options from which the user can choose one or more. Unlike a group of checkboxes or ‘Option buttons, the ListBox control can contain many lines and the user can scroll the list to locate an item. The selected item in a ListBox control is given by the Text property. Another important property of the ListBox control is the Sorted property, which determines whether the items in the list will be sorted.

The Horizontal and Vertical Scroll Bars

The horizontal and vertical scroll-  bars let the user specify a magnitude (the current location in a long piece of text, a numeric value, and so on) by scrolling the control’s button between its minimum and maximum value.


You can use this control to perform tasks, at regular intervals. The main property of the Tuner control is Interval, which determines how often the Tuner notifies your application. If the Interval property is set to 10000,the Timer control issues a Timer event every 10 seconds.

File System Controls

You use these controls to add file-handling capabilities to your application. They are normally used together ‘to provide an interface for accessing and exploring drives, folders, and files. The File System controls are:

Drive ListBox

This control displays the drives on the system in a drop-down list from which the user can select,

Directory ListBox

This control displays a list of all folders in the current drive and lets the user move up or down in the hierarchy of the folders.

File ListBox

This control displays a list of all files in the current folder.


This control is used to draw graphical elements, such as boxes and circles, on the surface of a Form.


Similar to the Shape control, the Line control is used to draw lines on a Form.


This control is similar to the PictureBox control in that it can display images, but it supports only a few features of the Picture Box control (you can’t draw on an Image control as you can on the PictureBox control) and requires fewer resources .


1;his control provides point-and-click access to data stored in databases. It has many properties and methods.


This control is a window you can place on your Form to host  documents from other applications, such as Microsoft Word or Excel. Through this control, you can access the functionality of other applications, if.they support OLE.

Posted on November 4, 2015 in Getting Started with Visual Basic

Share the Story

Back to Top