Subject: Ministry of Higher Education and Scientific Research

advertisement

Ministry of Higher Education and

Scientific Research

Babylon University

College of Material Engineering

Non-Metal Engineering Department

First Lecture: An Introduction

Subject: Programming in Visual Basic

Language

Class: Second Year

Lecturer: Hussein Mohammed Salman

2014-2015

Visual Basic implements graphical user interface that allows the use of graphics for different applications. It provides visual interactive windows with user , like

Dialogue box for(color, font, ….), input box , output box. Also it is able to create menu to simplify user application.

To run this language follow this path:

Start>programs>Microsoft visual studio>Microsoft visual basic .

The visual basic provides an organized environment that allows user to use different computer units like mouse , keyboard , printer and works independently of the designed application (for example it prints independent of printer type).

The Importance of VB Program:

Languages like Basic and Pascal depend on variables and procedures to build the applications. This is why it is procedural languages. The new approach called object programming for visual programs like visual basic and visual C++ and

This Lecture allowed on: www.uobabylon.iq.edu

1

Ministry of Higher Education and

Scientific Research

Babylon University

College of Material Engineering

Non-Metal Engineering Department

Subject: Programming in Visual Basic

Language

Class: Second Year

Lecturer: Hussein Mohammed Salman

2014-2015 other. In this programming approach everything (form, command buttons ,activeX control) is an object.

The reasons for implementing Visual Basic program are:

1It uses Integrated Development Environment (IDE) which is easier for the user to minimize code writing.

2All visual programs follow the same concepts , therefore the user will become more familiar with visual approach for other visual language.

3The core of the visual basic program is the powerful Form Designer that makes form design fast and easy. The form designer creates and modifies visual forms.

Forms: are objects that have their properties , events and methods. Forms provide a viewing interface with a set of objects that can respond to user (or system) events of user application tasks.

4The Designer of the visual basic provides different types:

A) Forms for window style applications. These forms are either based on custom templates or designed by user by adding and modifying various types of objects on the forms. These form windows can be moved around within the form. They can be single forms or multiple as a form set that consist of one or more forms that can be manipulated as a unit.

B) DHTML page for Internet Explorer .

5It uses many tools and boxes as standard tools , and common dialog ,OLE

(object linking embedding ), and other.

6It provides input box and output box as an interactive windows with user.

This Lecture allowed on: www.uobabylon.iq.edu

2

Ministry of Higher Education and

Scientific Research

Babylon University

College of Material Engineering

Non-Metal Engineering Department

Subject: Programming in Visual Basic

Language

Class: Second Year

Lecturer: Hussein Mohammed Salman

2014-2015

7It uses API. The API are windows-routines added to visual basic code by copy and paste process.

8It is able to connect to Internet and to call Explorer.

Elements of the Integrated Development Envirnment(IDE):

The IDE consist of many elements. Some elements are displayed when visual basic is started (by default); other elements are displayed if the user required them.

We will describe only default elements of the IDE so that will viewed in the lab.

1Menu Bar: contain a standard command like: File ,Edit , View, … etc. Each of these standard commands consist of list of commands.

2Tool Bar: contains the most commonly used commands(buttons) , if clicked an action represented by that button is dragged away by the mouse.

3Tool Box : contains a collection of tools that are needed for project designed.

Usually this tool box is placed on the left side of the IDE window. It can be dragged away by the mouse. These tools will described in details in the next lectures.

4Project Explorer Window: is a list of the forms and modules for the current projects. It is a hierarchical tree-branch structure , where the project at top of the tree and other parts(forms, modules) descend from this tree.

5Form Designer : is a window for each form to customize the designed inter face of the application. Using the form designer, the user can add control, graphics, and text to create the desired form appearance. The form can be moved around in the form design window by the mouse. The form designer called the application window.

This Lecture allowed on: www.uobabylon.iq.edu

3

Ministry of Higher Education and

Scientific Research

Babylon University

College of Material Engineering

Non-Metal Engineering Department

Subject: Programming in Visual Basic

Language

Class: Second Year

Lecturer: Hussein Mohammed Salman

2014-2015

6Properties Window :is a list of properties setting for a selected form or a control. These properties are characteristics (such as size, visible or color) of the selected object. It provides an easy way to set properties. It can be dragged away by the mouse.

The properties window consist of the following elements :-

A) Object Box: displays the name of the object for which the properties are listed below in the list. If user clicks on arrow in the right side of this box, the list of all objects in the form are displayed. If user selects object from list, the properties of that object are displayed.

B) Sort Tabs: To view listing of properties in alphabetic or a hierarchical

(divided in groups of similar type such as appearance and position).

C) Properties List: A list of properties for the selected object that user can view and edit settings in the right column.

Setting of the items could be done in one of three ways:

First: By edit , if it has a predefined value.

Second: Clicked on arrow on the right side to select one of the settings.

Third: Click on the dotted button to open a dialog box.

This Lecture allowed on: www.uobabylon.iq.edu

4

Ministry of Higher Education and

Scientific Research

Babylon University

College of Material Engineering

Non-Metal Engineering Department

Exercises:

Subject: Programming in Visual Basic

Language

Class: Second Year

Lecturer: Hussein Mohammed Salman

2014-2015

1.

What is Visual Basic?

2.

What are the reasons to use the Visual Basic language?

3.

What is the Procedural languages? Why is it name with procedural language?

4.

Visual Basic called with other name what is? Why?

5.

How run Visual Basic?

6.

What is the integrated development environment?

7.

List the elements of the IDE?

8.

What is form designer?

9.

What are forms? What are their types?

10.

What are the styles of set properties in VB?

This Lecture allowed on: www.uobabylon.iq.edu

5

Download