0% found this document useful (0 votes)
25 views32 pages

Oop

Uploaded by

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

Oop

Uploaded by

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

1.

How to add a code to a


button?

The code must be entered


between Private Sub……End
Sub
2. How to save the project?

Menu bar File Save All


Type your filename Click
Browse Create directory
for solution should remain
checked
3. How to open the project?

Documents Visual Studio


2010
Users PC# Projects
Using a Message Box

A message box produces a pop-up


message and prompts the user to click
on a command button. It can respond
to invalid data or if user has neglected
to provide data that is being required.
The basic components of a message
box are:
1. Text message- string
2. Title bar-string
3. Message box button-user will click
4. Icon-to help explain the purpose of
the message box
Icon
Title bar

Message box
Message button
Visual Basic 2010
-is now a complete
object-oriented
programming language.
The developments of
programming languages
are as follows:
 Procedural –this was the
style of programming of the
first 3GL programming
languages. It is older,
traditional, sequential type
of programming which is
used by the following: BASIC,
 Visual Basic 6.0 and
earlier VBs were event-
driven programs which
were still procedural but
contain some elements of
object-oriented
 Visual Basic.NET (2003,
2005, 2008 and 2010) are
full object-oriented
programming (OOP)
language.
Object-oriented programming
(OOP) is a programming style
that uses objects to design
an application or program.
OOP is a programming
paradigm that attempts to
mimic the way people think
and deal with the world.
OOP techniques may
include the following features:
Data
Encapsulation Modularity
Abstraction
• refers to data • is a • is where data
bundling and programming and program are
restrictions to design technique represented by
access object’s that allows their close image
data; it is a way breaking down of representation.
of hiding data the software into
from the outside. modules and
each module
accomplishes a
given task on its
own.
OOP techniques may
include the following features:
Polymorphism Inheritance Messaging

• is the ability to • is reusing • is a means of


create codes of sending and
variables, existing receiving
functions and objects, and the messages as a
objects that establishment form of
allow more than of related communication
one form. objects with between
similar processes.
attributes and
behavior
Concepts of Classes, Objects,
Properties, Methods and Events
Class – a blueprint or template on which
all objects are based upon.
Object-will be on its value, variable or
data structure
Property-The object has color and size
as its properties and every object will
Concepts of Classes, Objects,
Properties, Methods and Events
Method-is a function or procedure
associated with a class.
Event- a user-initiated action. Each user-
initiated action causes an event to occur.
Event procedures-are codes written by the
programmer to react to an event; if no code
is written, VB will simply ignore the event.
Example of the concepts:
A car belongs to the Vehicle class.
The car’s brand (e.g. Toyota), model (e.g. Innova)
and color(e.g. red) of the car are properties of
the car.
Each and every car is an object of the Vehicle
class also called an instance of the Vehicle class.
We can imagine that the car that you see or own
belongs to the larger Vehicle Class.
When the car starts, stops or turn, these are
methods belonging to the Object car. These are
actions that a car does regularly.
An event occurs when the car pulls into a gas
Basic Steps for Writing
a Visual Basic Project
 Explore the files that make
up a Visual Basic project.
 Design the User Interface
(include controls needed so
as user can interact with the
 Set up the properties for
the controls e.g. names
 Coding-following the syntax rules
of VB.
Syntax-are the set of rules that
must be complied with including
spelling, punctuation marks,
spacing, symbols and other text
Various Timing and Modes in
Visual Basic

Design time – It is the time


spent in writing and designing
the codes for the user
interface. This is also the time
to edit your program.
Run Time- It is the time spent
when
a user runs an application.
Break Time- It is the time spent
in checking, debugging, and
other situations. At this time, no
changes can be made to the
program.
Kinds of Visual Basic Files
 Solution Files (.sln) –These are the
files that a programmer manipulate
and deal with. Avoid opening files
that are automatically created by VB
to prevent possible errors.
 Executable Files (.exe) –These are the
files that an end user will run in the
computer.
Errors in VB
Syntax (compile error) -is a violation or
error due to wrong spelling, symbols,
spacing and other factors that make a code
unacceptable. It is designated by a blue
curly line that appears under the code, this
is an indication that the VB editor does not
recognize the term.
Logic-is a program bug that causes
the application to produce an
incorrect or undesired output. The
best way to check for logic errors is
to do a test data run and check if the
result is as expected.
Runtime-is detected during the execution
of the program or when the program is
running. Missing files or links not available
are examples of the runtime errors.

You might also like