For in GOD we live, and move, and have our being. - Acts 17:28

The Joy of a Teacher is the Success of his Students. - Samuel Dominic Chukwuemeka

# Welcome to Visual Basic Programming

I greet you this day,
First: read the notes. Second: view the videos. Third: solve the questions/solved examples. Fourth: check your solutions with my thoroughly-explained examples.
Comments, ideas, areas of improvement, questions, and constructive criticisms are welcome. You may contact me.
If you are my student, please do not contact me here. Contact me via the school's system.
Thank you for visiting!!!

Samuel Dominic Chukwuemeka (Samdom For Peace) B.Eng., A.A.T, M.Ed., M.S

## Object-Oriented Programming Language

### Visual Basic Math Functions

Computer programs are actually collections of objects.
Each object contains data and the logic that operates on that data.

### Classes

A Class describes an object.
It is NOT an object. It just describes the object.
A Class is like a blueprint, while the Object is a building made from that blueprint.
For example (in the Grade Calculation Program),
the class is the Student class with fields/variables, properties, data types, constructors, and methods.
It has two fields/variables: Test 1 Score and Test 2 Score.
It computes the average of the two test scores, and assigns a grade based on that average.
We have students in the Student class, and we need to compute the average score and the grade for each student.
So, we begin with Student A.
Once we do this, Student A becomes an object (an instance/a creation of the class)
We fill in the data (the two test scores, and the average score and the grade is returned.
Then, we move to Student B.
Student B becomes another instance (object) of the class, Student.
We fill in the data (the two test scores, and the average score and the grade is returned.
...and so on and so forth.

Each Class in Visual Basic typically has Class Members
These class members include:

(1.) Fields. The fields represent the variables and data types.
What are the variables in the class?
What data types are these variables?

(2.) Properties. The properties describe the class data.
What type of data does the class hold?
Properties have Get and Set procedures.
The Get and Set procedures provide controls on how values are returned (in the case of $Get$) or set (in the case of $Set$).
Sometimes, the properties can be created as $ReadOnly$ properties and $WriteOnly$ properties.

If the programmer wants the variable to be read-only;
(a.) Then the $ReadOnly$ property is included in the $Get$ procedure.
(b.) That value of that variable cannot be modified.
(c.) The $Set$ procedure is omitted.

If the programmer wants the variable to be write-only;
(a.) Then the $WriteOnly$ property is included in the $Set$ procedure.
(b.) That value of that variable cannot be retrieved outside the class. It can only be set and used within the class.
(c.) The $Get$ procedure is omitted.

(3.) Methods. The methods describe the class behavior.
The methods in classes are also known as Functions
What actions are the object capable of performing?

(4.) Events. The events provide communication between different classes and objects.
Access Modifiers are used to determine the level of access among classes and class members.
Let us review these access modifiers and the level of access.

Access Modifier Level of access
Public Unrestricted
Any code can access it
Private Declaration
Only codes that are declared in a private element can access it
Protected Derivational
Codes in the class that declares a protected element, or a class derived from it, can access the element
Private Protected Union of Private and Protected: Declaration and Derivational
Codes in the class that declares a private protected element, or a derived class in the same assembly as the base class, can access the element

Benefits of Using Classes
(1.) Encapsulation
A class encapsulates (encloses in a capsule) the fields, properties, methods, and events of the object it instantiates.

(2.) Inheritance
Classes can inherit all the properties and behaviors of another class.
The main class whose members are inherited is known as the Base class or Super class
The class that inherits the members of the main class is known as the Derived class or Sub class

(3.) Abstraction
Classes especially built-in classes of Visual Basic abstracts/hides several details about a class so one can focus on the main details of the class.

Visual Basic has in-built classes.
You can also define your own classes (known as custom classes).
Class names (both in-built classes and custom classes) begin with an uppercase letter.

## Projects

### Student Work Samples - Desktop Apps

No worries!
These files are safe to run directly on any Windows Desktop from this website

### Desktop Apps

No worries!
These files are safe to run directly on any Windows Desktop from this website

### Definitions

A computer program is a set of instructions given to a computer to perform specific tasks.

A computer programmer also known as a coder is a person who writes computer programs.

### Definitions

A computer program is a set of instructions given to a computer to perform specific tasks.

A computer programmer also known as a coder is a person who writes computer programs.

## Bibliography

### References

Chukwuemeka, S.D (2016, April 30). Samuel Chukwuemeka Tutorials - Math, Science, and Technology. Retrieved from https://www.chukwuemekasamuel.com

Hoisington, C. (2015). Microsoft Visual Basic 2015 for Windows, Web, Windows Store, and Database Applications: Comprehensive. Boston, MA: Cengage Learning.

Zak, D. (2016). Programming with Microsoft Visual Basic 2015. ($7^{th}$ ed.). Boston, MA: Cengage Learning.