0% found this document useful (0 votes)
183 views67 pages

Cit191.0 Computer Laboratory 1.0

This document provides an overview of the main components that make up a computer system. It describes the external components located on the front and back of the system unit as well as the internal components found inside including the motherboard, processor, memory, expansion slots, and more. The document aims to familiarize readers with the key parts that work together to form a functional computer.

Uploaded by

timilehinadeoje
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
183 views67 pages

Cit191.0 Computer Laboratory 1.0

This document provides an overview of the main components that make up a computer system. It describes the external components located on the front and back of the system unit as well as the internal components found inside including the motherboard, processor, memory, expansion slots, and more. The document aims to familiarize readers with the key parts that work together to form a functional computer.

Uploaded by

timilehinadeoje
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

COURSE

GUIDE

CIT 191
COMPUTER LABORATORY I

Course Team Adegboyega Adebayo(Course Developer/Writer)-NOUN


Adenrele Afolorunsho(Course Developer/Writer)-NOUN
Francis Osang(Course Developer/Writer)-NOUN

J.N Ndunagu (Course Coordinator/Editor)-NOUN


CIT 191 COURSE GUIDE

NATIONAL OPEN UNIVERSITY OF NIGERIA

© 2023 by NOUN Press


National Open University of Nigeria
Headquarters
University Village
Plot 91, Cadastral Zone
Nnamdi Azikiwe Expressway
Jabi, Abuja

Lagos Office
14/16 Ahmadu Bello Way
Victoria Island, Lagos

e-mail: [email protected]
URL: www.nou.edu.ng

Printed 2020, 2022, 2023

ISBN: 978-978-058-754-3

All Rights Reserved


CRS 711 COURSE GUIDE

Contents

Introduction……………………………………………… iii
Working through this course materials Study units…….. iii
Course materials………………………………………… iv
Study units………………………………………………. iv

Introduction

Computer laboratory I: is a semester, 1-unit, 100- level core course


available to students registered for the B.Sc. (Hons.) Information
Technology and B.Sc. Computer Science.

The course will consist of twelve (12) units of lectures organized into 3
modules. The lectures will cover the concepts of Computer Hardware,
Networking and Computer Programming. The course aims to assist you
in gaining practical understanding of the diverse contexts of Computer
Hardware Networking and Computer Programming.

This course requires you to gain some practical experience on how to


configure a computer network and also write simple computer
programs.

To achieve this, you will be required to perform various practical


exercises in each of the lectures. You should endeavor to do these
exercises, in addition to the tutor marked assignments (TMAs) that you
are required to submit for marking during this course. Some of the
exercises will also require you to use microcomputer software, for
which basic skills in computer operation is required. The course will
enable you to obtain skill as a prerequisite for CIT104.

This Course Guide tells you briefly what the course is all about, what
course materials you will be using, and how you can work your way
through these materials. It suggests some general guidelines for the
amount of time you are likely to spend on each unit of the course in
order to complete it successfully. It also gives you some guidance on
your tutor-marked assignments (TMAs).

You will be required to attend some tutorial classes that are linked to
the course. Details of times and locations of, and tutors for, the tutorials
will be communicated later.

Working through this course

To complete this course, you are required to read the study units and
read other materials provided by the department. You will also need to

ii
CIT 191 COURSE GUIDE

undertake practical exercise for which you need access to a personal


computer with Windows operating system. Each study unit contains
self-assessment exercises, and at a point in the course, you are required
to submit assignments for assessment purposes.

Course materials

Main components of the course are:


1. Course Guide
2. Study units
4. Assignment File (will be available at the NOUN website)
5. Presentation Schedule (will be available at the NOUN website)

Study units

There are 12 study units in this course organized into three modules as
follows:

Module 1: Computer Hardware

Unit 1: Hardware Components (1)


Unit 2: Hardware Components (2) – Peripheral Devices
Unit 3: Auxiliary Equipment

Module 2: Computer Networking


Unit 1 Network Cables
Unit 2 Network Devices
Unit 3 Network Internet Protocols Addressing
Unit 4 Local Area Network
Unit 5 Basic Network Command
Module 3: Computer Programing
Unit 1 Programming in Visual Basic
Unit 2 Visual Basic Project Window
Unit 3 Creating Menu Applications
Unit 4 Analyzing Visual Basic Data

iii
CIT 191 MODULE 1

MODULE 1 COMPUTER HARDWARE

UNIT 1 COMPUTER HARDWARE COMPONENTS (1)

1.0 Introduction

Your Personal Computer (PC) is really a collection of separate items


working together as a team-with you as the captain. Some of these
components are essential; others simply make working more pleasant
or efficient. Adding extra items expands the variety of tasks you
can accomplish with your machine.

2.0 Learning Outcomes

The Learning Outcomes of this unit are to:

i. Familiarize the student with the components of the computer.


ii. Enable the student to appreciate the importance of each of the
components to the overall smooth operations of the computer.
iii. Make students to be able to couple a system together

3.0 The System Unit

The system unit is the main unit of a PC. It is the Computer itself
while other units attached to it are regarded as peripherals. It could be
viewed as the master conductor orchestrating your PC’s operation. It
is made up of several components like the Motherboard, Processor,
Buses, memory, power supply unit, etc. This unit (system unit) has
been confused over the years by novices as the CPU. This is not
true. The CPU (Central Processing Unit) or simply processor is a
component within the system unit and it is not the only thing that
makes up the system unit. Hence, it will be wrong to equate the
system unit with the CPU.

3.1 Front of the System Unit

Light
Your system may display a variety of colored light on the front panel,
including power and turbo signals, and light to indicate if the Hard or
Floppy disk are being read or written to.

Key Lock
You can stop intruders tampering with your PC by using the Lock on
the front panel. Turning the key prevents the key board from working.

1
CIT 191 COMPUTER LABORATORY I

Turbo Button
Some PCs offer a choice of speeds at which they can run. A turbo
switch is usually left so the computer runs at its fastest speed.

Reset Button
If your PC “freezes” and won’t respond to any command, try starting
it up again using the reset button. Pressing the reset button loses all the
work you have not saved in that session, so use it only as a last resort.

Power On/Off
All PCs have main power switch on the system unit. Sometimes this
control is placed on the outside back panel.

CD-ROM DISK DRIVE

A CD-ROM Drive or optical drive is the device used to read Compact Disc
Read-Only Memory. CD-ROM drives have speeds ranging from 1x to 72x,
meaning it reads the CD roughly 72 times faster than the 1x version. As you
would imagine, these drives are capable of playing audio CDs and reading
data CDs, including CD-R and CD-RW discs.

3.2 Back of the System Unit

Fan Housing
The electronic components in your PC generate a lot of heat. To
prevent overheating, a fan at the back of the unit removes hot air from
the system.

Power “in” and “out” Sockets


Cables plugged into these sockets carry power from the electrical
outlet to the system unit and from the system unit to the monitor.

USB Ports
A USB port is a standard cable connection interface for personal computers
and consumer electronics devices. USB stands for Universal Serial Bus, an
industry standard for short-distance digital data communications. USB ports
allow devices such as keyboard, mouse etc. to be connected to each other
with and transfer digital data over USB cables.

2
CIT 191 MODULE 1

3.3 Inside The System Unit

The brain behind everything that happens in your PC is contained


within the system unit. Inside the unit are the impressive electronics
that run programs, handle instructions, and determine the results.
Most of the more important items are described below:

Battery
A small battery powers a clock to keep track of the time when the PC is
turned off. It also maintains low electricity to certain RAM chips that
record which components are installed.

Disk Drive Controller Card


This card controls the PC’s disk drive motors and transfers data.
The serial and parallel ports at the back of the card link internal PC
components with external devices such as mouse and printer.

Display Adapter Card (Video Card)


All the information your computer will display is stored in its memory.
To be useful, you need to see the information. The display adapter
card is the link between the PC’s memory and the monitor.

Expansion Slots

These long narrow connectors allow you to plug in expansion cards


(also known as adapter cards), which offer extra options not available
on a basic PC.

ROM Chips

Read-only memory (ROM) chips have data written on them during


manufacturing that tells the CPU what to do when the PC is switched
on. The data is always there, even when you switch the PC off.

3
CIT 191 COMPUTER LABORATORY I

RAM Chips

When a computer is switched on and running a program, RAM


(Random Access Memory) is used for purposes such as holding the
program and its data. But when the PC is switched off, anything held in
RAM is lost.

Empty RAM Chip Slots


These slots let you expand your computer’s memory by adding extra
RAM chips or modules. Some PC’s work even faster because they
come equipped with Cache Memory. Cache Memory consists of
expensive and very fast memory chips that store the data or instructions
that the CPU will look at next. Cache memory can speed up work on
your computer enormously.

Central Processing Unit (CPU)

Intel Processor

The Microprocessor, or Central Processing Unit (CPU), is the


computer’s most important single item. It does all the PC’s thinking
and runs the programs (series of instructions) that you request.

4
CIT 191 MODULE 1

CPU Support Chips


These chips help the CPU manage all the other parts of the computer.

Math Coprocessor Slot


A math coprocessor, present in some PCs, assists the CPU in its
number-crunching activities (if programs have been designed to use it).

CPU fan

Speaker
The speaker emits the computer’s sound output.

Power Supply Unit


All the components in a PC need electrical supply. Most need a 5-
volt supply although the floppy disk drive motors required 12 volts. If
the components were connected to normal household current, they
would blow up, so the power supply unit converts high voltage
electrical current to a low voltage.

Hard Disk Drive


The hard disk is your computer’s main permanent storage unit,
holding large amount of data and programs. Unlike data held in
RAM, the information on the hard disk is not affected when the PC
is turned off – it remains there unless you instruct the PC to
overwrite it or the hard disk is damaged.

5
CIT 191 COMPUTER LABORATORY I

Hard drive (Hard disk)

Motherboard
All the electronic components in a PC are mounted on a piece of
fiberglass called the motherboard. Fiberglass cannot conduct
electricity, so each component is insulated from all the others. Thin
lines of metal on the surface of the fiberglass connect pins from one
component to another, forming the computer’s electrical circuits.

Intel CPU

The earliest PCs were equipped with a CPU from Intel Corporation
called the 8088. the next generation of PCs used CPU known by
the number “80286 and were called “PC/AT” computers.
Subsequently, PCs have been supplied with more and more
powerful CPUs – the 80386, the 80486, and the more recent and
impressive of all, the Intel Pentium (I, II, III, IV& M).

All these PC processors belong to a family called 80 x 86. In


general, you can run the same software on PCs containing different
CPUs within this family. From the outside, the chips look different
only in sizes and number of pin-put inside, an 80486 has over one

6
CIT 191 MODULE 1

million components to the 3,500 that were in the first 8088. Because of
these differences, the latest Pentiums runs over ten times faster.

4.0 Tutor-Marked Assignment

a. Make a list of 5 components that could be found inside the


computer systems unit.
b. Describe the functions of each of them.
c. Differentiate between CPU and the Systems unit.

7
CIT 191 COMPUTER LABORATORY I

5.0 References/Further Reading

Akinyokun, O.C, (1999). Principles and Practice of Computing


Technology. International Publishers Limited, Ibadan.

Balogun, V.F., Daramola, O.A., Obe, O.O., Ojokoh, B.A., and


Oluwadare S.A., (2006). Introduction to Computing: A Practical
Approach. Tom-Ray Publications, Akure Richard H. Austing
and Lillian Cassel (1986). Computers in Focus. Books/Cole
Publication Company. Monterey, California.

Larry Long (1984). Introduction to Computers and Information


Processing. Prentice-Hall Inc., New Jersey.

8
CIT 191 MODULE 1

UNIT 2 HARDWARE COMPONENT (2) – PERIPHERAL


DEVICES

1.0 Introduction

The computer peripheral devices are those devices which are attached to
the system unit. The devices are necessary to ensure that the computer
is able to accept input and display the result for the user. This section
therefore discusses the input unit and the output unit.

2.0 Learning Outcomes

The learning outcomes of this unit are to:


i. Expose the students to those components that make up the input
unit and the output unit.
ii. Enable students get deeper understanding of the functions of the
input and the output unit.
iii. Guide the students on the type of input unit and output unit
suitable for a particular computing environment.

3.0 Input Devices

3.1 Computer Keyboard

A Computer keyboard is identical to the conventional typewriter


keyboard. However, it has more keys than the typewriter keyboard. A
computer keyboard can be a dummy type or intelligent type. A
computer keyboard is considered to be intelligent if, in addition to
performing the routine functions characteristic of a typewriter
keyboard, it can initiate a series of actions for a computer to carry out
by mere pressing a key or combination of two or more keys. An
intelligent computer keyboard has a set of keys and when one of them is
pressed, the computer can be made to carry out a specific function. For
example, the pressing of a key may cause the computer to display a
menu list from which a human being may be prompted to select one.
The intelligent computer keyboard has four major divisions, namely:
Function keys, Alphanumeric keys, Numeric keys and Control keys.
In addition to the four types of keys, there are some special or important
keys such as the following:

(a) Return or Enter key


(b) Escape key denoted by ESC
(c) Control key denoted by CTRL
(d) Alternate key denoted by ALT
(e) Delete key denoted by DEL
(f) Insert key denoted by INS

9
CIT 191 COMPUTER LABORATORY I

(g) Backspace key


(h) Shift key.

3.2 Mouse

A mouse looks like the electrical clipper in a barbing saloon. It


consists of a pointing device very sensitive to movements. It has a
roller ball and two or more buttons which can be pressed to make
selection. By moving the mouse on a flat smooth surface and clicking
one or combination of two buttons on its upper surface, a computer to
which it is connected can be sensitized and commanded to carry out
some specific tasks.

A mouse can be used to draw diagrams on computer screen more


effectively and efficiently than the computer keyboard. Generally, the
keyboard and the mouse do complement each other. For example, the
mouse can be used to highlight an item in a menu list while the
keyboard Enter Key can be pressed to activate or evoke the command
associated with the highlighted item.

A mouse is the primary input device for modern computers that


feature operating systems with a graphical user interface, such as
Windows 98 or Windows XP. While keyboards obviously excel at
entering text, numbers, and symbols, your mouse is the tool you'll use to
tell your computer what to do with all the data you've entered.

3.3 Output Device

3.3.1 Printers

A printer is the computer component that lets you create copies of the
information stored in your computer on paper. The printed material is
often called hard copy, to differentiate it from the data stored on a disk,
or held in the computer's memory.

3.3.2 Monitors

The monitor does not do any processing itself. The monitor only
displays the information that the video card tells it to. The two most
common monitor sizes are 15-inch and 17-inch. If you have an older,
hand- me-down PC or a very inexpensive starter PC, you may have a
smaller 14-inch monitor. 21-inch monitors are also available but mostly
used by graphics professionals.

10
CIT 191 MODULE 1

3.3.3 Scanners

Scanners are peripheral devices used to digitize (convert to electronic


format) artwork, photographs, text, or other items from hard copy. In a
sense, a scanner works as a pair of eyes for your PC. Your eyes see an
image and translate the image into electrical impulses that travel to and
are interpreted by your brain. Similarly, a scanner captures images and
converts them to digital data that travel to and are interpreted by the
computer. A scanner works by dividing an image into microscopic
rows and columns and measuring, like the film in a camera, how
much light (or lack thereof) reflects from each individual intersection
of the rows and columns. Each reflection is recorded as a dot, or
picture element (pixel). After the scanner collects information from
each dot, it compiles the result into a digital file on the computer. There
are a wide variety of scanners that work in a number of different ways,
but the technology behind them is essentially the same. The following
sections discuss more popular types of scanners available today.

3.3.4 Speakers and Sound

The built-in speakers in most PC cases are used just for making system
sounds, such as warning beeps and action indicators. To play more
sophisticated sounds on your PC, you need a set of external speakers.
Usually speakers come in pairs, and there is a plug that connects them
to your sound card. Arrange the speakers with one on the left and one
on the right of your desk or work area to get a stereo effect.

Optionally, some speakers come with a subwoofer. This improves the


bass (low notes) sound. If you have a subwoofer with your speakers, it
should go on the floor under your desk.

4.0 Conclusion

The system unit cannot function without the peripheral devices. The
input and the output units are very important peripheral devices that
must be taken care of in setting up a computer system.

5.0 Summary

In this unit we have learnt the following:

i. Input unit which comprises


(a) T he keyboard – the different categories of keys on the keyboard
and their functions.
(b) The scanner – different types of scanners

11
CIT 191 COMPUTER LABORATORY I

ii. The output unit which is made up of the


(a) Monitor,
(b) The printer and, (c) the speakers.

6.0 Tutor-Marked Assignment

a. Justify the need for the input and the output units in a computer
system.
b. Describe the functions of the following keys: the numeric keys,
control keys, shift keys and the function keys.
c. In what situation will you recommend the laserjet printer and
the dot matrix printer.

7.0 References/Further Reading

Akinyokun, O.C, (1999). Principles and Practice of Computing


Technology. International Publishers Limited, Ibadan

12
CIT 191 MODULE 1

UNIT 3 AUXILLARY EQUIPMENT

1.0 Introduction

The auxiliary equipment as their name suggests are not computers but
are necessary in a computing environment in order to ensure proper
functioning and smooth running of computing activities. In this unit,
we shall address in some details the importance of equipment such as
air conditioner, voltage stabilizer, uninterruptible power system and
line transformer in a data processing environment.

2.0 Learning Outcomes

The Learning Outcomes of this unit are to:

i. Identify the auxiliary equipment in a computing environment.


ii. Discuss the importance of the auxiliary equipment to the smooth
running of a computing centre.

3.1 Air Conditioner

A Computer is an electronic machine. It is, therefore, capable of


generating heat. A computer is manufactured to operate in an
environment with a specific temperature range. When the
temperature of the environment in which a computer is kept falls
outside the specific range, the computer may function badly and
consequently get damaged.

The free air is basically, dust laden. Dust is metallic in nature and, as
such, capable of conducting electricity. If dust is allowed to settle
on a computer, particularly the electronic circuits, the dust can
bridge two circuits. The bridging of two electronic circuits may
cause a serious damage to the computer. Thus, air conditioners are
needed in a computer environment to:
(a.) Control the temperature
(b.) Prevent dust.

3.2 Voltage Stabilizer

A computer when switched on, takes off at a cold state, warms up and
gradually gets to a hot state. At a hot state, a computer is always
roaming in an attempt to find something to do. In a situation where the
public electricity such as that of PHCN in Nigeria is cut suddenly, the
computer would suddenly be brought to a halt. The sudden power cut
may cause the computer to lose the memory of some basic
housekeeping operations when power eventually returns and the
13
CIT 191 COMPUTER LABORATORY I

computer is switched on. The sudden power cut may also cause
irreparable damages to the file the computer was processing at the time
the power was suddenly cut.

3.3 Line Voltage Transformer

We note that computers are built to operate within a specific range of


voltages. In the United State of America, computers are built to
operate on 110V. A voltage transformer is a device meant to step up or
step down a voltage as the case may be. In Nigeria, for example, a
110V computer requires a voltage transformer to step down the
240V to 110V. Similarly, in USA, a 240V current is connected
directly to a 110V computer, the computer power unit will blow up
almost immediately.

Today, the technology has improved tremendously such that if a


240V current is connected directly to a 110V computer, only a fuse,
rather than the power unit will blow up. It is worth mentioning, too,
that there is an advanced technology today which permits a computer to
operate effectively and efficiently with the power line voltage ranging
between 110V and 240V. The technology supports an inbuilt switch
which can be operated at two terminals namely: the 110V terminus
and 240V terminus. In recent times, the technology has been
improved upon such that computers are manufactured in such a way
that they can sense the voltage that is adequate. Thus, if one connects a
110V computer to a 240V current, the 110V computer has an in-built
line transformer which automatically steps down the 240V current to
110V.

3.4 Uninterruptible Power Supply System (UPS)

An Un-interruptible Power System (UPS) is an auxiliary hardware that


is capable of:
(a) Converting the public electricity raw line into fine line, that is,
conditioning the voltage that is fed into the computer.
(b) Storing electrical energy when the public electricity line is life
(c) Releasing the stored electrical energy to the computer
when the public electricity line is dead.

4.0 Conclusion

The computer is an expensive resource and as such requires adequate


protection from electrical damage. Similarly, the UPS is an expensive
resource; hence there is the need for it to be protected from electrical
damage, too. Therefore, in practice, it is desirable that the UPS be
protected by a voltage stabilizer which is rugged and less expensive.

14
CIT 191 MODULE 1

The configuration presented in Figure is an example of a computer


environment characterized by the multiple levels of protection
from electrical damage. This arrangement is desirable in a situation
of electrical surge and blown out.

5.0 Summary

In this unit you have learnt the following:

i. Auxiliary devices create a facilitative and conducive


environment for smooth operation of computers and the user.
ii. Voltage stabilizers help to protect computing equipment from
damage due to power surge.
iii. UPS protects the computing equipment and the software from
power outage during computing session. The UPS with the help
of its internal battery stores electrical energy while power is on
and releases power stored to the computer whenever power is
off. This enables the user to end the working session and shut
down normally.
iv. A voltage transformer is a device meant to step up or step down
a voltage as the case may be.

6.0 Tutor-Marked Assignment

With the aid of annotated diagram, describe the arrangement of the


following auxiliary equipment: UPS, line voltage transformer and
voltage stabilizer in relation to PHCN power source and the
computer.

7.0 References/Further Reading

Akinyokun, O.C, (1999). Principles and Practice of Computing


Technology. International Publishers Limited, Ibadan.

Balogun, V.F., Daramola, O.A., Obe, O.O., Ojokoh, B.A., and


Oluwadare S.A., (2006). Introduction to Computing: A Practical
Approach. Tom-Ray Publications, Akure.

15
CIT 191 MODULE 2

MODULE 2 COMPUTER NETWORKING

UNIT 1 NETWORK CABLES

1.0 INTRODUCTION

Networking cables are a type of networking hardware used to connect a


network device to one or more other network devices, or to connect two
or more devices to a single computer or network device. Network cables
act as a medium through which information and data travel from one
network device to another. The type of cable used for a network depends
on the network’s topology, size, and procedure. The different types of
network cables act as the supporting basis of the network infrastructure.

2.0 LEARNING OUTCOMES

By the end of this unit, students will be able to:

• Identify different types of network cables


• Prepare network cable
• Connect cables in a network.

3.0 MAIN CONTENT

3.1 TYPES OF NETWORK CABLE

Coaxial Cable
Coaxial cables have a single copper conductor at the center, while a
plastic layer provides insulation between the center conductor and
braided metal shield. The metal shields outside interference.
Coaxial cabling is highly resistant to signal obstruction, although it can
be complex to install. It can handle greater cable lengths between
network devices than twisted pair cables. The two types of coaxial
cables are thick coaxial and thin coaxial cables.

Fiber Optic Cable


Fiber optic cables possess a center glass core surrounded by multiple
layers of protective materials. They avoid electrical obstruction by
transmitting light instead of electronic signals, making them perfect for
environments with large amounts of electrical interference. Fiber optic
cables have become the standard for connecting networks across
buildings because of their resistance to moisture and lighting.

Shielded Twisted Pair (STP) Cable


Often referred to colloquially as simply ethernet cables, STP cables
employ a special type of copper telephone wiring used for business

16
CIT 191 COMPUTER LABORATORY I

installations. An external shield functioning as a ground is added to the


standard twisted pair of telephone wires.

Shielded twisted pair cables can be perfect if you want to set up cables
in an area with potential interference and risks to an unshielded twisted
pair cable’s electrical current. Shielded twisted pair cables can also help
to expand the distance between the cables.

Unshielded Twisted Pair (UTP) Cable


Unshielded twisted pair (UTP) cables are broadly used in the
telecommunications and computer industries as ethernet cables and
telephone wires. In a UTP cable, conductors forming a single circuit are
twisted around one another to cancel out electromagnetic interference
(EMI) from external sources.

3.2 How to implement the cross-wired cable and straight through


cable
Apparatus :
RJ-45 connector, Climping Tool, Twisted pair Cable, Cable Tester

Procedure:
1. Start by stripping off about 2 inches of the plastic jacket off the
end of the cable. Be very careful at this point, as to not nick or
cut into the wires, which are inside. Doing so could alter the
characteristics of your cable, or even worse render is useless.
Check the wires, one more time for nicks or cuts. If there are any,
just whack the whole end off, and start over.

2. Spread the wires apart, but be sure to hold onto the base of the
jacket with your other hand. You do not want the wires to
become untwisted down inside the jacket. Category 5 cable must
only have 1/2 of an inch of 'untwisted' wire at the end; otherwise
it will be 'out of spec'. At this point, you obviously have ALOT
more than 1/2 of an inch of un-twisted wire.

3. You have 2 end jacks, which must be installed on your cable. If


you are using a pre-made cable, with one of the ends whacked
off, you only have one end to install - the crossed over end.
Below are two diagrams, which show how you need to arrange
the cables for each type of cable end. Decide at this point which
end you are making and examine the associated picture below.

17
CIT 191 MODULE 2

Diagram shows you how to prepare Straight and Cross wired


connections

Figure 2: Cable Code for Cross Cable

18
CIT 191 COMPUTER LABORATORY I

Exercise 1
Practically implement the cross-wired cable and straight through cable
using clamping tool, and RJ45 connectors.

Take a picture of Implementation, print and append.

S/N STEPS COMMENTS MAX SCORE SCORE


1 CABLE 2
STRIPPING
2 CABLE 3
ARRANGMENT
(Cross-cable)
3 CABLE 3
ARRANGMENT
(Straight-cable)
4 END JACK 2
INSTALLATION

19
CIT 191 MODULE 2

UNIT 2 NETWORK DEVICES

1.0 INTRODUCTION

To solve network problems, network designers break a network into


smaller portions and connect them with networking devices such as
bridges, switches and gateways etc. Depending on the complexities of
each of the networks being connected, a choice is made between these
different network devices.

2.0 LEARNING OUTCOMES

At the end of this unit, students should be familiar with the functions of
the following Network device:

• Routers, Gateways, Modems, Repeaters, Bridges, Switches, Hubs

3.0 MAIN CONTENT

3.1 Repeaters

When a signal is sent over a long network cable, signal gets weakened due to
attenuation. This results in some data getting lost in the way. In order to
boost the data signal, Repeaters are needed to amplify the weakened signal.

3.2 Bridges

Bridges were created to allow network administrators to segment their


networks transparently. It manages network traffic by filtering packets.

3.3 Switches

A switch is a device that incorporates bridge functions as well as point–


to–point ‘dedicated connections’. They connect devices or networks.

3.4 Hubs

Hubs are multi–port repeaters and as such, they obey the same rule
as repeaters. Hubs are used to provide a Physical Star Topology. They
are also used to interconnect various incoming connections with
different outgoing connections at the Physical layer of the OSI Model.

20
CIT 191 COMPUTER LABORATORY I

3.5 Routers

In an environment consisting of several network segments with different


protocols and architecture, a bridge may not be adequate for ensuring
fast communication among all of the segments. A complex network
needs a device which not only knows the address of each segment, but
also can determine the best path for sending data and filtering broadcast
traffic to the local segment. It is used to connect two devices at the
network layer of the OSI Model

3.6 Gateway

Used to connect totally dissimilar networks because they can perform


protocol conversion for all seven layers of the OSI Model.

3.7 Modem

This is a device which is used to convert digital signals generated by the


computer into an analog signal to be carried by a public access
telephone line. It is also the device that converts the analog signal
received over a phone line into digital signal usable by the computer.

Exercise 2
Identify the following devices and outline two functions for each.
a.

Name: ............................... (1 marks)


Functions

(2 marks)

b.

21
CIT 191 MODULE 2

Name: ............................... (1 marks)


Functions

(2 marks)

c.

22
CIT 191 COMPUTER LABORATORY I

UNIT 3 NETWORKING IP ADDRESSING

1.0 INTRODUCTION

An IP address is a unique address that identifies a device on the internet


or a local network. IP stands for "Internet Protocol," which is the set of
rules governing the format of data sent via the internet or local network.
IP addresses are the identifier that allows information to be sent between
devices on a network: they contain location information and make
devices accessible for communication. The internet needs a way to
differentiate between different computers, routers, and websites. IP
addresses provide a way of doing so and form an essential part of how
the internet works.

2.0 LEARNING OUTCOMES

At the end of this unit, students should be able to:

• Classify of IP address
• D e v e l o p a n d c a l c u l a t e Sub netting
• D e v e l o p a n d c a l c u l a t e Super netting

3.0 MAIN CONTENT

3.1 Classification of IP address

TCP/IP defines five classes of IP addresses: class A, B, C, D, and E.


Each class has a range of valid IP addresses. The value of the first octet
determines the class. IP addresses from the first three classes (A, B and
C) can be used for host addresses. The other two classes are used for
other purposes – class D for multicast and class E for experimental
purposes.

The system of IP address classes was developed for the purpose of


Internet IP addresses assignment. The classes created were based on the
network size. For example, for the small number of networks with a
very large number of hosts, the Class A was created. The Class C was
created for numerous networks with small number of hosts.
Classes of IP addresses are:

For the Class Address Range Supports


Class A 1.0.0.1 to Supports 16 million hosts on each of 127
IP 128.1.0.1 to Supports 65,000 hosts on each of 16,000
Class B
address Class C 192.0.1.1 to Supports 254 hosts on each of 2 million
es from Class D 224.0.0.0 to Reserved for multicast groups.
Class A, Class E 240.0.0.0 to Reserved.
the first 254.255.255.254
23
CIT 191 MODULE 2

8 bits (the first decimal number) represent the network part, while the
remaining 24 bits represent the host part. For Class B, the first 16 bits
(the first two numbers) represent the network part, while the remaining
16 bits represent the host part. For Class C, the first 24 bits represent the
network part, while the remaining 8 bits represent the host part.
Consider the following IP addresses:

• 10.50.120.7 – because this is a Class A address, the first number


(10) represents the network part, while the remainder of the address
represents the host part (50.120.7). This means that, in order for
devices to be on the same network, the first number of their IP
addresses has to be the same for both devices. In this case, a device
with the IP address of 10.47.8.4 is on the same network as the
device with the IP address listed above. The device with the IP
address 11.5.4.3 is not on the same network, because the first
number of its IP address is different.
• 172.16.55.13 – because this is a Class B address, the first two
numbers (172.16) represent the network part, while the remainder of
the address represents the host part (55.13). A device with the IP
address of 172.16.254.3 is on the same network, while a device with
the IP address of 172.55.54.74 isn’t.

3.2 Sub netting

Subnetting is a process of dividing a single large network in multiple


smaller networks. To best utilize available addresses if we put more than
16000000 hosts in a single network, due to broadcast and collision, that
network will never work. If we put less hosts then remaining addresses
will be wasted. Subnetting provides a better way to deal with this
situation. Subnetting allows us to create smaller networks from a single
large network which not only fulfill our hosts’ requirement but also offer
several other networking b Identifying network portion and host portion
in an IP address is the first step of Subnetting. Subnetting can only be
done in host portion. Subnet mask is used to distinguish the network
portion from host portion in an IP address. benefits.

24
CIT 191 COMPUTER LABORATORY I

3.3 SUPER NETTING

Supernetting is the process of summarizing a bunch of contiguous


Subnetted networks back in a single large network. Supernetting is also
known as route summarization and route aggregation. Supernetting is
mainly done for optimizing the routing tables. A routing table is the
summary of all known networks. Routers share routing tables to find the
new path and locate the best path for destination.

25
CIT 191 MODULE 2

The figure shows an example of Supernetting

Advantage of Supernetting
• It reduces the size of routing updates.
• It provides a better overview of network.
• It decreases the use of resources such as Memory and CPU.
• It decreases the required time in rebuilding the routing tables.

In order to perform the Supernetting, we need Network ID, CIDR Value,


Broadcast ID, Subnet Mask and Block Size of each route.

26
CIT 191 COMPUTER LABORATORY I

UNIT 4 LOCAL AREA NETWORK

1.0 INTRODUCTION

A local area network is a relatively smaller and privately owned network


with maximum span of 10km to provide local connectivity within a
building or small geographical area. The LANs are distinguished from
other kinds of networks by three characteristics; Size, Transmission
technology, and Topology.

2.0 LEARNING OUTCOMES

By the end of this unit, students will be able to;

• Connect the computers in Local Area Network.(LAN)

3.0 MAIN CONTENT

In this unit, the computers are connected in LAN by configuring both the
host and client computers considering the following steps:

3.1 Configuration of the host computer

1. Log on to the host computer as Administrator or as Owner.


2. Click Start, and then click Control Panel.
3. Click Network and Internet Connections.
4. Click Network Connections.
5. Right-click the connection that you use to connect to the
Internet. For example, if you connect to the Internet by using a
modem, right-click the connection that you want under Dial-up /
other network available.
6. Click Properties.
7. Click the Advanced tab.
8. Under Internet Connection Sharing, select the Allow other
network users to connect through this computer's Internet
connection check box.
9. If you are sharing a dial-up Internet connection, select the
Establish a dial-up connection whenever a computer on my
network attempts to access the Internet check box if you want
to permit your computer to automatically connect to the Internet.
10. Click OK. You receive the following message:

When Internet Connection Sharing is enabled, your LAN adapter


will be set to use IP address 192.168.0. 1. Your computer may lose
connectivity with other computers on your network. If these other
computers have static IP addresses, it is a good idea to set them to
27
CIT 191 MODULE 2

obtain their IP addresses automatically. Are you sure you want to


enable Internet Connection Sharing?

11. Click Yes.

The connection to the Internet is shared to other computers on the local


area network (LAN). The network adapter that is connected to the LAN
is configured with a static IP address of 192.168.0.1 and a subnet mask
of 255.255.255.0

3.2 Configuration the client computer

To connect to the Internet by using the shared connection, you must


confirm the LAN adapter IP configuration, and then configure the client
computer. To confirm the LAN adapter IP configuration, follow these
steps:

1. Log on to the client computer as Administrator or as Owner.


2. Click Start, and then click Control Panel.
3. Click Network and Internet Connections.
4. Click Network Connections.
5. Right-click Local Area Connection and then click Properties.
6. Click the General tab, click Internet Protocol (TCP/IP) in the
connection uses the following items list, and then click
Properties.
7. In the Internet Protocol (TCP/IP) Properties dialog box, click
Obtain an IP address automatically (if it is not already
selected), and then click OK.

Note: You can also assign a unique static IP address in the range of
192.168.0.2 to 254. For example, you can assign the following static IP
address, subnet mask, and default gateway:
8. IP Address 192.168.31.202
9. Subnet mask 255.255.255.0
10. Default gateway 192.168.31.1
11. In the Local Area Connection Properties dialog box, click OK.
12. Quit Control Panel.

Exercise 3
Practically implement the connection of client -host computers in a
LAN.
Instructor will inspect each student's LAN implementation. Print and
append output.

28
CIT 191 COMPUTER LABORATORY I

S/N STEPS COMMENTS MAX SCORE


SCORE
1 Configuration 4
the host
computer
2 Configuration 4
the client
computer
3 Output 2

29
CIT 191 MODULE 2

UNIT 5 BASIC NETWORK COMMANDS

1.0 INTRODUCTION

Network commands are used to perform network configuration which


includes how to switch to privilege mode and normal mode and how to
configure router interface and how to save this configuration to flash
memory or permanent memory.

2.0 LEARNING OUTCOMES

By the end of this unit, students will be able to;

• use basic network commands for network configuration.

3.0 MAIN CONTENT

This commands includes

• Configuring the Router commands


• General Commands to configure network
• Privileged Mode commands of a router
• Router Processes & Statistics
• IP Commands
• Other IP Commands e.g. show it route etc.

ping:
ping(8) sends an ICMP ECHO_REQUEST packet to the specified host.
If the host responds, you get an ICMP packet back. Sound strange?
Well, you can “ping” an IP address to see if a machine is alive. If there is
no response, you know something is wrong.

30
CIT 191 COMPUTER LABORATORY I

Tracerout:
Tracert is a command which can show you the path a packet of
information takes from your computer to one you specify. It will list all
the routers it passes through until it reaches its destination, or fails to
and is discarded. In addition to this, it will tell you how long each
'hop' from router to router takes.

nslookup:
Displays information from Domain Name System (DNS) name servers.
NOTE :If you write the command as above it shows as default your pc's
server name firstly.

pathping:
A better version of tracert that gives you statics about packet lost and
latency.

31
CIT 191 MODULE 2

Getting Help
In any command mode, you can get a list of available commands by
entering a question mark (?). Router>?
To obtain a list of commands that begin with a particular character
sequence, type in those haracters followed immediately by the question
mark (?).

Router#co?
configure connect copy
To list keywords or arguments, enter a question mark in place of a
keyword or argument. Include a space before the question mark.

Router#configure ?
memory Configure from NV memory network Configure from a TFTP
network host terminal. Configure from the terminal.

You can also abbreviate commands and keywords by entering just


enough characters to make the command unique from other commands.
For example, you can abbreviate the show command to sh.

Configuration Files
Any time you make changes to the router configuration, you must save
the changes to memory because if you do not they will be lost if there is
a system reload or power outage. There are two types of configuration
files: the running (current operating) configuration and the startup
configuration.

Use the following privileged mode commands to work with


configuration files.

Performing Switch Configuration


Step 1: Configure the switch host name.
a. From the Customer PC, use a console cable and terminal emulation
software to connect to the console of the customer Cisco Catalyst
2960 switch.
b. Set the host name on the switch to CustomerSwitch using these
commands.
Switch>enabe
Switch#configure terminal

Switch(config)#hostname CustomerSwitch
Step 2: Configure the privileged mode password and secret.
a. From global configuration mode, configure the password as cisco.
CustomerSwitch(config)#enable password cisco
b. From global configuration mode, configure the secret as cisco123.
CustomerSwitch(config)#enable secret cisco123

32
CIT 191 COMPUTER LABORATORY I

Step 3: Configure the console password.


a. From global configuration mode, switch to configuration mode to
configure the console line. CustomerSwitch(config)#line console 0
b. From line configuration mode, set the password to cisco and require
the password to be entered at login.

CustomerSwitch(config-line)#password cisco CustomerSwitch(config-


line)#login CustomerSwitch(config-line)#exit

Step 4: Configure the vty password.


a. From global configuration mode, switch to the configuration mode
for the vty lines 0 through 15.
CustomerSwitch(config)#line vty 0 15
b. From line configuration mode, set the password to cisco and require
the password to be entered at login.
CustomerSwitch(config-line)#passwordcisco
CustomerSwitch(config-line)#loginCustomerSwitch(config-
line)#exit

Step 5: Configure an IP address on interface VLAN1.


From global configuration mode, switch to interface configuration mode
for VLAN1, and assign the IP address
192.168.1.5 with the subnet mask of 255.255.255.0.
CustomerSwitch(config)#interface vlan 1
CustomerSwitch(config-if)#ip address 192.168.1.5 255.255.255.0
CustomerSwitch(config-if)#no shutdown
CustomerSwitch(config-if)#exit

Step 6: Configure the default gateway.


a. From global configuration mode, assign the default gateway to
192.168.1.1.
Customer Switch(config)#ip default-gateway 192.168.1.1

b. Click the Check Results button at the bottom of this instruction


window to check your work.

Step 7: Verify the configuration.


The Customer Switch should now be able to ping the ISP Server at
209.165.201.10. The first one or two pings may fail while ARP
converges.
CustomerSwitch(config)#end
CustomerSwitch#ping 209.165.201.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 209.165.201.10, timeout is 2
seconds:
..!!!

33
CIT 191 MODULE 2

Success rate is 60 percent (3/5), round-trip min/avg/max = 181/189/197


ms CustomerSwitch#

Exercise 4

Practically Implement the Switch Configuration using the steps earlier


discussed.

S/N STEPS COMMENTS MAX SCORE


SCORE
1 Configure the 1.5
switch host
name.
2 Configure the 1.5
privileged mode
password and
secret.
3 Configure the 1.5
console
password.
4 Configure the 1.5
vty password.

5 Configure an IP 1.5
address on
interface
VLAN1.

6 Configure the 1.5


default gateway.

7 Verify the 1
configuration.

34
CIT 191 COMPUTER LABORATORY I

MODULE 3

UNIT 1 PROGRAMMING IN VISUAL BASIC

1.0 INTRODUCTION

Visual is an event driven language which has some features of Object


Oriented Programming (OOP). Actions are tied to the occurrence of
events e.g. an action may be triggered by clicking the mouse. This
approach make application programs more friendly and natural to the
end user. In this unit students are introduced to the concept of working
with graphical objects and the general Visual Basic Programming
concepts.

2.0 Learning Outcomes

The objective of this unit is to introduce students to:

• The concept of working with graphical objects and the general


Visual Basic Programming concepts.
• How to design a project from the application wizard and,
• How to use the toolbox.

3.0 Learning To Run Visual Basic Applications

These sessions will include learning how to work with graphical objects
in the Visual Basic Environment and using general Visual Basic
Programming concepts.

How To Design A Project From The Application Wizard.

A project is a collection of files that make up your application. A


single application might consist of several files, and the project is the
collection of those files.

The application wizard can be selected from the New Project dialog box.
If you cancel the New Project dialog box, and then later want to start the
Application wizard, select File, New Project to display the New Project
dialog box once again. The screen you see looks like that in Figure 1.

35
CIT 191 MODULE 3

Figure 1

When you select the icon labeled VB Application Wizard on the New
tab, the wizard begins its work. The interface type you select will
determine how your application will process multiple windows. See
figure 2.

Figure 2

36
CIT 191 COMPUTER LABORATORY I

Figure 3

You can select the options you want your application’s menu to contain
as shown in Figure 3 above. The options are common Windows options
found on most Windows programs. The ampersand (&) next to a letter
in a menu name indicates the underscored accelerator key letter; in other
words, &New indicates that New appears on the menu and that the use
can select the option by pressing Alt+N.

The next wizard screen, shown in Figure 4, lets you select the toolbar
buttons that your application will have. Click next to accept all the
default toolbar settings.

Figure 4

The next wizard screen to appear is the Resource screen from which you
can select to use resources in your program. The next one is the Internet
Connectivity screen from which you can add an Internet interface to
your program if you want one. The next screen gives the option of
adding one of these standard screens to your application:

37
CIT 191 MODULE 3

• Splash screen is an opening title screen that appears when


your application first begins.
• Login dialog is a dialog box that asks for the user’s ID and
password as a part of application security that you can add.
• Options dialog is tabbed blank dialog box from which your
users can specifyattributes that you set up for the application.
• About box is a dialog box that appears when your users select
Help, About from the application menu.

You can also select a form template from here. A form template is
model of a form that you can customize.

Click Next to get to the last screen and click the Button labeled Finish
to instruct Visual Basic to complete your initial application.

How To Create A Project From The New Project Window

The New Project window appears, when you first start Visual Basic or
when you select File, New Project. You will always need toolbars in
your project. Visual Basic has a total of four toolbars:
• Debug. This toolbar appears when you use the interactive
debugging tools to trace and correct problems.
• Edit. This toolbar aids your editing of Visual Basic code.
Form Editor. This toolbar helps you adjust objects on forms.
Standard. This toolbar is the default toolbar that appears
beneath the menu bar.

You can display and hide these toolbars from the View, Toolbars menu.

Using the Toolbox


The Toolbox window differs from the toolbar. The toolbox is a
collection of tools that act as a repository of controls you can place on a
form. Figure 5 shows the most common collection of toolbox tools that
you’ll see.

Selection pointer Picture

Label boxText
Option
Combo box
buttonList
Horizontal
scrollbar box
Lin
Timer

Figure 5

38
CIT 191 COMPUTER LABORATORY I

The Form Window

Most of your work goes on inside the Form window. You’ll design all
your application’s forms, which are the background windows that your
users see, in the central editing area where the Form window appears.
You can resize the Form window to make the windows you create in
your application as large or small as needed. An application may contain
multiple forms: you can display one or more of those forms in their own
Form window editing areas. Activate a form by clicking a form by
clicking anywhere within the window or on the title bar.

The Form Layout Window


The Form Layout window is an interesting little window connected
closely to the Form window, because the Form Layout window shows
you a preview of the Form window’s location.

4.0 CONCLUSION

Visual Basic programming language is one of the most popular


application programming languages which is easy to learn. It is event
driven and have some attributes of Object Oriented Programming. These
attributes has made it one of the most preferred languages in Windows
environment.

5.0 SUMMARY

In this unit, we have learnt the following:

(a) The concept of working with graphical objects and the general
Visual Basic Programming concepts.
(b) How to design a project from the application wizard and,
(c) How to use the toolbox.

6.0 TUTOR-MARKED ASSIGNMENT

a. What is a toolbox in Visual Basic Programming environment?


b. List and discuss the functions of ten items in Visual Basic
toolbox

39
CIT 191 MODULE 3

7.0 References/Further Reading

Akinyokun, O.C, (1999). Principles and Practice of Computing


Technology.

International Publishers Limited, Ibadan.

Balogun, V.F., Daramola, O.A., Obe, O.O., Ojokoh, B.A., and


Oluwadare S.A., (2006).

Introduction to Computing: A Practical Approach. Tom-Ray


Publications, Akure.

Francis Scheid (1983). Schaum’s Outline Series: Computers and


Programming. Mcgraw-Hill Book Company, Singapore.

40
CIT 191 COMPUTER LABORATORY I

UNIT 2 VISUAL BASIC PROJECT WINDOW

1.0 INTRODUCTION

The project window enables the user or programmer to navigate the


items created in a project such as the forms and modules. The property
window on the other hand helps the programmer to choose the
appropriate properties for and object. When you display the Properties
window for a control, you can modify its values. You can do that by
selecting the view option and then Properties window.

2.0 Learning Outcomes

The objective is to enable user gain more mastery of the Visual Basic
programming environment.

The project Window

The Project Window helps you to manage your application’s


components. It lists its components in a tree-structured listing. Related
objects appear together. You can expand or shrink the details by
clicking the plus sign next to the object labeled Forms, a list of the
current project’s forms will appear.

The following kinds of objects can appear in the Project window:

• Projects
• Forms
• Modules
• Class modules
• User controls
• User documents
• Property pages

4 The Properties Window

A form can hold many controls. As you add controls to a form, you can
select a control by clicking the control. When you select a control, the
Properties window changes to list every property related to that control.
When you add a control to a Visual Basic application, Visual Basic sets
the control’s initial property values. When you display the Properties
window for a control, you can modify its values. You can do that by
selecting the view option and then Properties window.
Figure 6 shows a Properties window listing some of the properties for a
Label control.

41
CIT 191 MODULE 3

Figure
Example 1

Create an application with three controls, a label, a command button


and an image control to look like what you have in Figure 7.

Figure

Guide to the solution


To place a control on a form, click on the control’s icon on the toolbox
and move the crosshair mouse cursor to the form. As you drag the
mouse, Visual Basic draws the control’s outline on your form. When
you have drawn the control at its proper location and size, release the
mouse button to place the control at its proper location. Assign the
following property values to the application’s forms and controls:

42
CIT 191 COMPUTER LABORATORY I

Control Property Property value


Form Max Button False
Label Alignment Center
Label Name LblHappy
Label Caption Have a happy day!

Label Font Courier New


Label Font style Bold
Label Size 36
Label Left 1320
Label Height 1695
Label Top 120
Label Width 4695
Image Name imgHappy
Image Stretch True
Command button Name cmdHappy
Command button Caption Click Here

While writing your application, you can run the application to see what
you have done by pressing F5.

You need to add some codes to finalize the application. Double click
the form somewhere on the grid inside the Form window to display the
code window. Add the codes shown in Figure 8.

To return to the Form window, click the Project window’s View Object
button.

43
CIT 191 MODULE 3

Figure 3
Run your program and click the command button. An image like that
shown in Figure 7 appears. Save your project and click the Close
window to terminate the program. To save, Select File, Save Project.
The Save Project option saves every file inside your project as well as
a project description file with the filename extension. VBP. Visual
Basic asks first for the filename you want to assign to your form. Visual
Basic then asks first for a project for the project description file.
Answer No if Visual Basic asks to add the project to the Source Safe
library.
Example 2

Create an application to look like what is shown in Figure 9, to include a


label, a textbox (where the secret characters will be entered), an image,
and two command buttons.

Figure 4

Guide to the solution


Set these controls and properties on the form:

Control Property Name Property Value


Form Name frmPassword
Form Caption Try a password
Form Height 5610
Form Width 8475
Image Name imgPassword
Image Border Style 1-Fixed Single
Image Height 1890
Image Left 3000
Image Stretch True
Image Top 2640
Image Width 2295
Label Name lblPrompt
Label Border Style 1-Fixed Single

44
CIT 191 COMPUTER LABORATORY I

Label Caption Type the secret password below


Label Font MS Sans Serif
Label Font Size 14
Label Font Style Bold

Label Height 855


Label Left 2520
Label Top 600
Label Width 3375
Text box Name txtPassword
Text box Height 375
Text box Left3360
Text box PasswordChar *
Text box Text (Leave blank by clearing the default value)
Text box Top 1600
Text box Width 1695
Command button Name cmdTest
Command button Caption &Test Password
Command button Left 6360
Command button Top 3000
Command button #2Name cmdExit
Command button #2Caption E&xit
Command button #2Left 6360
Command button #2Top 3720

Add the following code seen on the screen in Figure 10 to activate the
password- based form:

Figure 5

45
CIT 191 MODULE 3

After running the application, you have what is shown in figure


11 below:

Figure 6

4.0 CONCLUSION

The project window and the property window are very important to
features of the Visual Basic programming environment that are of
immense importance to the programmer.

5.0 SUMMARY

In this unit we have studied the importance of the project window and
the propertywindow.

6.0 TUTOR MARKED ASSIGNMENT

Create an application with three multiline text boxes. Make the text
boxes tall enough to display three or four lines of text. Give the first one
a vertical scrollbar, the second a horizontal scrollbar, and the third one
both kinds of scrollbars. In all the three text boxes, supply the default
text “Type here”. In addition to the text boxes, include an Exit
command button, so the user can press Alt+X to terminate program.

46
CIT 191 COMPUTER LABORATORY I

7.0 REFERENCES/FURTHER READING

Akinyokun, O.C, (1999). Principles and Practice of Computing


Technology. International Publishers Limited, Ibadan.

Balogun, V.F., Daramola, O.A., Obe, O.O., Ojokoh, B.A., and


Oluwadare S.A., (2006).

Introduction to Computing: A Practical Approach. Tom-Ray


Publications, Akure.

Francis Scheid (1983). Schaum’s Outline Series: Computers and


Programmg.

47
CIT 191 COMPUTER LABORATORY I

UNIT 3 CREATING MENU APPLICATIONS

1.0 INTRODUCTION

One of the basic features of the Graphical User Interface (GUI) is that
enables user to select the operations to be performed through menus
with the aid of the mouse. In this unit students are introduced to the
rudiments of creating a menu application.

2.0 LEARNING OUTCOMES

The objective of this unit is to enable students learn the steps involved in
creating visual basic applications with menu.

3.1 Creating menu applications

You can generate menus for your applications using the application
wizard. After you click the menu options and submenus you want in
your applications, the Application wizard generates the appropriate
menu controls and places them in the generated application.

The Toolbox window does not contain any menu-creation tools.


Instead, Microsoft offers a special menu tool called the Menu Editor,
shown in Figure 13 that you use to create menus. From the Form
window, you can press Ctrl+E to display the Menu Editor.

The Menu Editor helps you design menus for your applications. In a
way, the Menu Editor acts like a Properties window for the menu bar
because you will designate the names of the menu controls as well as
the captions that the users see on the menus and other related
information from within the Menu Editor.

Menu
properties

Menu control
list box

Figure 1
CIT 191 MODULE 3

A menu bar offers a special kind of control that lets your select options
and issue Menu bar
commands.

Disabled options Enabled options

Shortcut

Checked option

Separator Selected option


Submenu

Figure 2

Figure 2 displays the menu bar and its parts.

Practice creating of menu applications with the following Exercise 4.

Example 1

Create an application with three menu options and a label. Your


screen should look like what you have in Figure 3.

160
CIT 191 COMPUTER LABORATORY I

Figure 3

Guide to solution

To create the menu bar, click the form and press Ctrl+E to display the
Menu Editor.
► Type &File for the Caption field. As with all other Visual Basic
values, the ampersand indicates that the F will be the accelerator
key for the menu selection. As you type the caption, Visual Basic
displays the caption in the Menu control list box in the bottom
half of the Menu Editor.
► Press Tab to move to the Name field. Tab and Shift+Tab shift the
focus between the Menu Editor fields.
► Type mnuFile for the name of the first menu option.
► Leave all other fields alone and click the Next button to prepare
for the remaining menu bar options. The Next button lets the
Menu Editor know that you are through with the first option and
want to enter another.
► Type &Color for the next menu bar caption and type mnuColor
for the name.
► Click Next to add the next item.
► Type &Message for the third and final menu bar caption and
type mnuMessage for the caption. Your Menu Editor should look
like the one in Figure 2.
CIT 191 MODULE 3

Figure 4.

3.2 Adding a Pull-down menu

You can either create pull-down menus as build the menu bar or add the
menus later. If you create the complete menu bar first, however as
you’ve done in this exercise, you’ll have to insert the menu options in
their respective locations when you are ready to add them. The Menu
Editor’s Insert button lets you do just that.

Example 2

Add three checked options: Blue, Green, and Red, to the second menu,
Color. These colors will be mutually exclusive; the label will not be able
to be all three colors at once, but only one color at a time. Such colors
make perfect candidates for checked menu options. Your application
should like Figure 17 after running. Also, include a submenu to the
Message menu. Let it contain the checked messages displayed in Figure
18, and include a separator bar as shown.

162
CIT 191 COMPUTER LABORATORY I

Figure 17

Figure 5.

Figure 6

Follow these steps to do these:


► Open the Menu Editor
► Click the &Message option in the Menu control list box to
CIT 191 MODULE 3

highlight that option.


► Click the Insert button and right arrow button three times to add
three empty rows for the Color menu options.
► Highlight the first blank row where you’ll add the Blue option.
► Type &Blue for the caption and mnuColorBlue in the Name field.
When the user first runs the program, the Blue option will be
unchecked to indicate that Blue is not currently selected.
► Click Next to enter the next option.
► Type &Green for the caption and mnuColorGreen in the Name
field of the next option.
► Click Next to enter the next option.
► Type &Red for the caption and mnuColorRed for the name of
the next option.
► The Red option is to be checked when the user first starts the
program. Therefore, click the Checked field to place the check
mark next to Red.
► Close the Menu Editor and run your application.
► To add the Message menu, display the Menu Editor and click the
row beneath &Message in the lower half of the Menu Editor to
prepare the Menu editor to receive the next option.
► Follow the steps as for the Color menu.
► To create the separator bar, after entering the first item, click
next and type a single hyphen(-) for the caption (all separators
bars have this caption). Type mnuMessageSep1 as the separator
bar’s name.
► Fix the other options appropriately and run the application.

To finalize the menu with code:

Open the code window and type the code shown in Figures 19 and 20.
The code controls the label’s colour and contents.

Figure 7

164
CIT 191 COMPUTER LABORATORY I

Figure 8

When the application is run, the screens look that those in Figures 4
and 5. For Figure 4, colour blue was selected with the second message
“VB is Simple”.

Figure 9
CIT 191 MODULE 3

Figure 10

4.0 CONCLUSION

Menus make programs interactive and enable programs to be written in


modules.

5.0 SUMMARY

In this unit we have learnt how to create a menu application.

6.0 TUTOR MARKED ASSIGNMENT

Enumerate the steps involved in creating a menu application.

166
CIT 191 COMPUTER LABORATORY I

7.0 REFERENCES/FURTHER READING

Akinyokun, O.C, (1999). Principles and Practice of Computing


Technology. International Publishers Limited, Ibadan.

Balogun, V.F., Daramola, O.A., Obe, O.O., Ojokoh, B.A., and


Oluwadare S.A., (2006).

Introduction to Computing: A Practical Approach. Tom-Ray


Publications, Akure.

Francis Scheid (1983). Schaum’s Outline Series: Computers and


Programming. Mcgraw-Hill Book Company, Singapore.
CIT 191 MODULE 3

UNIT 4 ANALYSING VISUAL BASIC DATA

1.0 INTRODUCTION

Here, Students will learn more about the Code window, and practice
their programming skills on declaration of data, use of variables of
different data types and use of operators.

2.0 LEARNING OUTCOMES

The objective of this unit is to enable students learn more about the
code window and gain mastery of how to operate in the code window.

Analysing Visual Basic Data Working inside the Code Window


The Code window contains several sections which include:

• The Declarations section


• General-purpose procedures
• Event procedures

Figure 1 shows the declarations sections in the first set of codes. After
the first wrapper line, there is an event procedure followed by another
one. General-purpose procedures can be meant to perform any kind of
function like computing some data, while event procedures will be
executed after the clicking of a mouse once or twice, the loading of a
form, or any other event.

Figure 1

The output of the code displayed in Figure 23 is shown in Figure 24.

168
CIT 191 COMPUTER LABORATORY I

Figure 2

More of use of variables together with the control of programs with


conditional operators, logical operators and FOR DO loops are
described in the Exercises below:

Example 1

Write and Run a Visual Basic Program to solve the Quadratic Equation
Problem, ax2+bx+c.

Solution

The code that provides the solution to the problem using the IF- THEN
statement are shown in Figures 3 and 4. This contains statements
explaining most of the basic concepts a beginning VB Programmer
needs to know. The output of the program is displayed in Figure 5. As it
can be seen, key words are in blue, comments are in green while the
other codes are in black.
CIT 191 MODULE 3

Figure 3

Figure

170
CIT 191 COMPUTER LABORATORY I

Figure 5

Solving the same problem using SELECT CASE statement, we have


the codes displayed in Figure 6.

Figure 6
CIT 191 MODULE 3

Example 2

Write and Run a Visual Basic Payroll Program for 10 employees of a


company. The Gross pay sums the Basic pay, Housing allowance and
Professional allowance (where applicable). Workers’ Grade levels range
from 1 to 16. Housing allowance of workers is 30% of Basic pay for
workers on levels 8-16 and 40% for levels 1-7 workers. Transport
allowance is 20% of Basic pay for all workers. Hazard allowance is
15% of Basic pay for only levels 8-16 workers. The Net pay, which is
the take home pay, is the Gross pay
– Tax (10% of Gross pay). Design a form through which each worker’s
data can be entered (to look like the one displayed in Figure 7)

172
CIT 191 COMPUTER LABORATORY I

Figures 9 and 10 display the code.


4.0 CONCLUSION

The code window is very important to visual basic programming.


Ability to write good programs depends to a large extent on its mastery.

5.0 SUMMARY

In this unit we have learnt how to program in the code window.:

6.0 TUTOR-MARKED ASSIGNMENT

Using the code window, write a program to display the current time.

7.0 REFERENCES/FURTHER READING

Akinyokun, O.C, (1999). Principles and Practice of Computing


Technology. International Publishers Limited, Ibadan.

Balogun, V.F., Daramola, O.A., Obe, O.O., Ojokoh, B.A., and


Oluwadare S.A., (2006). Introduction to Computing: A Practical
Approach. Tom-Ray Publications, Akure.

Francis Scheid (1983). Schaum’s Outline Series: Computers and


Programming. Mcgraw-Hill Book Company, Singapore.

You might also like