Sie sind auf Seite 1von 27

DATABASE CONCEPT

IN
PROGRAMING
LANGUAGE 2

STARTING VISUAL BASIC


To load the Visual Basic program
1. Click the Start button on the Taskbar. Select Programs and choose VB6
(Visual Basic 6) from the pop-up menu.

2. You can also open Microsoft Visual Basic program by clicking the Visual
Basic icon if there is a shortcut icon set on the desktop.

The first window that you will see after clicking the VB6 is the Project
Wizards New Project dialog box. From this window, you can select several
types of projects. This window has three tabs:

New displays the project


type you can open.
Existing locates and selects
the project that you want to
open.
Recent tab lists the most
recently opened projects and
their location.

New Project Wizards window tab offers you several project templates:
Standard EXE

Active EXE

Active X DLL

Active X Control

VB Application Wizard
Data Project
Add-in

VB Wizard Manager
ISS Application
Activex Document DLL

Active X Document EXE


VB Enterprise Edition Controls

DHTML Application

DRAWING CONTROLS
Controls are seen in the Form Layout window, a general purpose window.
These are the graphics and input/output devices. All control-drawing tools are
located in the Toolbox, which is a panel on the left of the screen.
To draw a control
1. Click the appropriate Toolbox icon.
2. Move the pointer to the form area.
3. Click where you want the objects top-left corner to go.
4. Drag to size the control.
OR
5. Double-click the icon.
6. Use the mouse to move and size the control as desired.

To create a command button


1. Double-click the Command Button icon.
2. Drag this button to a position on the right side of the form.
3. Repeat the procedure.
To resize the form
4. Choose the form by clicking on any blank area.
5. Hold the sizing handles.
6. Drag the mouse.

VISUAL BASIC ENVIRONMENT


The Visual Basic environment plays and important role in developing a project.
This is where you will spend most of your time in putting together all of your
applications. Visual basic environment is also called Integrated Development
Environment (IDE).

IDE is the term used in the programming world to describe the interface and
environment to create your application. Visual Basic is called IDE because you
can access virtually all the development tools you need from one screen.

VISUAL BASIC ENVIRONMENT


The Visual Basic environment is made up of different components.
Menu Bar
Form Layout window
Toolbar
Toolbox
Project Explorer
Form Designer
Properties window

Menu Bar

Form Designer

Project Explorer

Toolbar

Toolbox
Properties
window

Form
Layout
window

Opening Visual Basic Project


The Visual Basic project is composed of all the code and design elements for a given
application. The final output is not a part of the project. If you want to change or use the
project again, you have to find files.
The project us always saved in the name Project1 by default. You can change the names of the
projects into meaningful names.
The project contains information about what the files are in the work and which is the start-up
form. If the file is in a multiple form application, it contains a list of all the forms and how
they are stored.
To open the project
To save and rename project
1. Open the VB program.
1. Open the File menu.
2. Click New Project in the File menu. 2. Choose the Save Project as command.
Ex. ShapesForm (.frm extension name)
ShapesDemo (.vbp extension)
To return to an existing project after closing
1. Open File menu.
2. Choose the Open Project command and choose your file name.

MOUSE TECHNIQUES
Visual Basic is designed to be used in conjunction with the mouse, the mouse has two buttons:
the left button which is used most of the time, and the right button which is used for special
functions. However, operation in Visual Basic can also be controlled using the keyboard.
Below are mouse techniques to remember.
MOUSE TECHNIQUE
Click

MEANING
To quickly press and release
the mouse button

Double-Click

To click the mouse button


twice in rapid succession

Drag

To hold down the mouse


button while you move the
mouse

Point

To move the mouse until its


pointer rest on the item of
choice

VISUAL BASIC WORKPLACE


The Visual Basic workplace is what you see on your screen. This is where you
create your application. The Visual Basic workplace contains different
windows and bars with different functions.
Main window is the large window in the middle of the screen where you
design your form.
The Menu Bar
The Menu Bar displays the Visual Basics IDE
(Integrated Development Environment) commands.

The Toolbar
This provides the quick access to commonly-used commands in the
programming environment.

To move a toolbar
1. Click the toolbar button and hold the mouse button.
Drag the button to a new position on the screen.
2. Notice that there is an imaginary box moving while you move your mouse.
If the imaginary box is in the position you want, let go off the mouse and
the toolbar drops into its new position.
To remove and add menu item on your menu bar/toolbar
1. Right click the toolbar at the top of the screen.
3. Select Customize from the pop-up menu.
4. Select the Commands tab from the Customize dialog box.
5. In the Categories list, scroll down to the bottom and select Built-in Menus.
6. Go up and look for Help menu on the Visual Basic menu bar and drag it to
the Command list. Once the menu item is over the list, drop it.
The Help menu has been removed from your menu bar.
6. Select Help menu from the Command list and drag it back to the Menu Bar
and drop it back in its original position.
7. Click Close to save your modification.
The Toolbox
This contains useful tools needed during design time. These tools are used to
place controls in a form.

To organize your toolbox


1. Right-click a blank area of the toolbox.
2. Select Add Tab from the pop-up menu.
3. When Visual Basic prompts you to enter a new tab name, type Internet.
4. Click the OK button.
5. Below the Toolbox is the new tab you have created.
To remove a toolbox add tab
6. Select the tab you have created.
7. Right-click.
8. From the pop-up menu, choose Delete tab.
The additional tab disappears.

Form Designer serves as the window or


frame to customize the design of an
applications interface.

Code Editor Window serves as the editor


for entering the Application code.
You can open the Code window
by double-clicking the form.

Project Explorer window displays all the forms


and modules of the current project. A project is a
collection of files (forms and modules) used to
build an application.
Internal Names is used in code to refer to a
specific form or module.
File Name of a form should be unique. It includes
the name of public procedures, methods and
properties.

File Name
Internal Name

Form Layout Window gives designer more


control over the screen positioning of forms. It
contains an icon representing a computer
screen and icon(s) for the form(s) in the
project.

Properties Window displays the property


setting of the selected form or control. It
contains different characteristics or
properties of selected objects. It has
different values for each property. The
following are some of the examples of
properties and their uses.

To change Boolean Value property in the Properties window


1. Load the Visual Basic program.
2. In the New Project window, choose Standard EXE.
Info
If the property has a True or False setting, this is Boolean. You can change the value by
double-clicking the name of the property in the first column of the Properties window.
3. Look for MaxButton property and change the setting to False.
4. Click Run menu, then start or simply press F5. this will run the program. Notice
that there is no longer a Maximize button on your form.

No Maximize button

To change the Predefined Value property in the Properties window


1. Load the Visual Basic program.
2. In the New Project window, choose Standard EXE.
3. Look for BorderStyle property in the Properties window.
You can change the setting from 0-5.
0 value removes all borders from the form.
1 value creates a thin border that cannot be resized.
2 value default value of a form. This can stretch the window to different sizes.
3 value fixed value of a window.
4 value for floating tool window.
5 value sizable value for window.
4. Set the BorderStyle to 3 Fixed Dialog.
5. Select Run menu, then Start or press F5.
Notice that the form has no Minimize and Maximize buttons and the form
cannot be resized

No Maximize and Minimize


button; the form cannot be resized.

To change String Value Property in the Properties window


1. Load the Visual Basic program.
2. In the New Project window, choose Standard EXE.
3. Click the form once to make it active.
4. In the Properties window, look for Property Name.
Double-click it.
5. Type frmMenu. Notice that the value on the right column is automatically deleted as
you type.
6. Press enter key.
7. Look for Caption Property, then double-click.
8. Type First Program.
Notice that the caption on your form was changed.

Property Name

Caption Name was changed

Property Caption

To change Hexadecimal Value Properties in the Properties window


1. Load the Visual Basic program.
2. In the New Project window, choose Standard EXE.
3. Double-click Back Color property in the Properties window.
4. Select the red color to change the background of the form to red.
5. If you want to change it, double-click the BackColor property again.
6. Select the System tab, then choose the Menu bar.
7. Select the System tab, then choose the Menu bar.
The red background turns back to its original color.

For Palette tab

For System tab

To change the Icon Property in the Properties window


1. Load the Visual Basic program.
2. In the New Project window, choose Standard EXE.
3. Double-click the Icon Property. This will display the Load Icon window on your
screen. You can now open your prepared icon on your target folder.
4. Click the Open button.
To change the Size Property in the Properties window
In changing the size property, there are four properties involved:
Left, Top, Width, and Height properties. You can change the value in the Properties
window. However, you can also use the dragging technique which is easier. Just drag the
sides of the form in the Form Designer. The value of the coordinates in the Properties
window automatically changes.

Left Setting

Top Setting

Width Setting

Height Setting

Das könnte Ihnen auch gefallen