Top Banner
DATABASE CONCEPT IN PROGRAMING LANGUAGE 2
27
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1-Starting Visual Basic

DATABASE CONCEPT IN

PROGRAMING LANGUAGE 2

Page 2: 1-Starting Visual Basic

STARTING VISUAL BASICTo 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.

Page 3: 1-Starting Visual Basic

The first window that you will see after clicking the VB6 is the Project Wizard’s 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.

Page 4: 1-Starting Visual Basic

New Project Wizard’s window tab offers you several project templates:

Standard EXE Active EXE

Active X DLL Active X Control

VB Application Wizard VB Wizard Manager

Data Project ISS Application

Add-in Activex Document DLL

Active X Document EXE DHTML Application

VB Enterprise Edition Controls

Page 5: 1-Starting Visual Basic

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 control1. Click the appropriate Toolbox icon.2. Move the pointer to the form area.3. Click where you want the object’s top-left corner to go.4. Drag to size the control. OR5. Double-click the icon.6. Use the mouse to move and size the control as desired.

Page 6: 1-Starting Visual Basic
Page 7: 1-Starting Visual Basic

To create a command button1. 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 form4. Choose the form by clicking on any blank area.5. Hold the sizing handles.6. Drag the mouse.

Page 8: 1-Starting Visual Basic

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.

Page 9: 1-Starting Visual Basic

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

Page 10: 1-Starting Visual Basic

Form Designer Project Explorer

Propertieswindow

FormLayoutwindow

Menu Bar

Toolbar

Toolbox

Page 11: 1-Starting Visual Basic

Opening Visual Basic ProjectThe 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 project1. 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 closing1. Open File menu.2. Choose the Open Project command and choose your file name.

Page 12: 1-Starting Visual Basic

MOUSE TECHNIQUESVisual 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 MEANING

Click 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

Page 13: 1-Starting Visual Basic

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 BarThe Menu Bar displays the Visual Basic’s IDE(Integrated Development Environment) commands.

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

Page 14: 1-Starting Visual Basic

To move a toolbar1. 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/toolbar1. 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 ToolboxThis contains useful tools needed during design time. These tools are used to place controls in a form.

Page 15: 1-Starting Visual Basic

To organize your toolbox1. 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 tab6. Select the tab you have created.7. Right-click.8. From the pop-up menu, choose Delete tab. The additional tab disappears.

Page 16: 1-Starting Visual Basic

Form Designer serves as the window or frame to customize the design of an application’s interface.

Code Editor Window serves as the “editor” for entering the Application code. You can open the Code window by double-clicking the form.

Page 17: 1-Starting Visual Basic

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.

Internal Name

File Name

Page 18: 1-Starting Visual Basic

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.

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.

Page 19: 1-Starting Visual Basic

To change Boolean Value property in the Properties window

1. Load the Visual Basic program.2. In the New Project window, choose Standard EXE.

InfoIf 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

Page 20: 1-Starting Visual Basic

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

Page 21: 1-Starting Visual Basic

No Maximize and Minimize button; the form cannot be resized.

Page 22: 1-Starting Visual Basic

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.

Page 23: 1-Starting Visual Basic

Property Name Property Caption

Caption Name was changed

Page 24: 1-Starting Visual Basic

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.

Page 25: 1-Starting Visual Basic

For Palette tab For System tab

Page 26: 1-Starting Visual Basic

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.

Page 27: 1-Starting Visual Basic

Left Setting Top Setting

Width Setting Height Setting