Visual Basic Online Course - OOP

Visual Basic Online Course - OOP

Visual Basic 2010 OOP Course
Visual Basic 2010 OOP
OOP Introduction
The original versions of Microsoft® Visual Basic® provided a mechanism for defining data structures in a user-defined type (UDT). A UDT encapsulates the data, but not the processing associated with that data. Processing was defined in global standard modules, often called BAS modules because of their .bas extension.

The release of Visual Basic 4 dawned a new age for Visual Basic developers. Visual Basic took its first steps toward becoming an object-oriented programming (OOP) language by providing object-oriented features such as class modules. 

A class module defines data as properties and the processing associated with that data as methods. By defining a class for each business entity, encapsulating data in properties and processing in methods, Visual Basic developers had object-based development.

As Visual Basic evolved from version 4 to version 6, Visual Basic developers expanded their knowledge of OO 'Object-Oriented' to include component-based development (CBD) techniques. With CBD, Visual Basic developers could build complete three-tiered applications for Microsoft Windows® and the Web. This type of development was so common that Microsoft provided a design pattern known as the Microsoft DNA architecture.

Visual Basic .NET provides another leap in Visual Basic development capabilities and features and provides for true object-oriented programming, as detailed in this article.


For a programming language to be a true OOP language, the language must meet the following criteria:

    Abstraction—Abstraction manages the complexities of a business problem by allowing you to identify a set of objects involved with that business problem.

    Encapsulation—Encapsulation hides the internal implementation of an abstraction within the particular object.

    Polymorphism—Polymorphism provides for multiple implementations of the same method. For example, different objects can have a Save method, each of which perform different processing.

    Inheritance—The excitement of Visual Basic .NET lies in inheritance. Visual Basic 5 introduced the concept of interface inheritance, which allows you to reuse the interface of a class, but not its implementation. Visual Basic .NET provides for true implementation inheritance whereby you can reuse the implementation of a class.

Now let's look at doing object-oriented programming in .NET.

OOP in Visual Basic .NET

Visual Basic .NET is not Visual Basic 6 with inheritance tacked onto it. Rather, Visual Basic .NET has been entirely rewritten to be fully object-oriented. In fact, everything in Visual Basic .NET can be treated as an object. Yes, even your strings and integers can be accessed as objects in Visual Basic .NET ............... Source WikiPedia

1) What's OOP ?
- Objects Oriented Programming
- It's the logic of programming

2) What does it do ?
- It helps the programmer to understand codes "where the code line came from - where is it going?" and enables him to be creative and able to create objects and controls .
3) OOP has 3 major concepts
  1. Inheritance
  2. Polymorphism
  3. Encapsulation
OOP Lesson Index /
  1. Classes Intro .
  2. Classes Studying .
  3. Sub & Function Concepts .(1 - 2)
  4. Property Programming
  5. Overloading - Inheritance
  6. Inheritance & Access Modifiers
  7. Implementations of OOP Concepts
  8. Make Your Own TextBox
1) Classes Intro
Classes are sections of Code but superior to any other code in the Forms ... let's take an example.
- in our example we will try to make an application that makes sure that the TextBox writes only Email format (I.e. : UserName@EmailServerName.Extension), ain't that represents the most common Email format used? ... OK.

Let's start a new Windows Form Application Project from Visual Basic 2010. Our project will aim to notify the user whether an Email format was provided in the TextBox control placed on the form or not. We shall call this project Email-Format-Validation.
  • Project Design [GUI] 
Visual Basic 2010 OOP course
Visual Basic Online Course OOP - Classes
As you can see the Project design is so simple :
Name : Form1
Name : Label1
Text : Name
Name : Label2
Text : E-mail
Name : TxtName
Name : TxtEmail
Name : BtnValid
Text : Validate E-mail
Now, what does it mean (Make sure the user writes E-mail address format correctly or in Email format)??
- Means we want the application to Check the TextBox.Text contents and determines Weather the User wrote (@ and .) in it, because this is what the common Email Address format looks like ,right?!
OK, so we write this block of codes in the Click Event In the BtnValid Control

What did we write ?
We created two variables (X,Y) as Integers, because we shall refer to the place where the (@) is, by using X variable and the and the place where the (.) is, by using Y variable. OK?!

The line where X = TxtEmail.Text.IndexOf("@") means that X = the IndexOf of the text in TxtEmail where IndexOf is a function in VB 2010 comes with the Text Property Of the TextBox Control, and it locates a character's position (Zero based index) within the Text in a TextBox, and it's called a (Built-in Function), OK?
Again, the line of code means (Locate the position of the (@) Character within the property Text in the Control TxtEmail, Please) ...
The line where it says, If X >= 1 Then means, if our user typed (@), then X "The position" must be bigger than or equals to 1 , why not (0) ??? 

Because (Ahmed) = (0 1 2 3 4) [and that is called a Zero based index, Ahmed has 5 elements starting A=0 and ends with D=4] also Emails don't start with (@) so the position (X) must be in the second letter (1) or in later position, so (if the user wrote (@) then checked for the (.) symbol, Y also represents the position of the (.) symbol but (@) can not come after (.), so we must make sure of that, and this is why we repeated IndexOf function, we used another property of the IndexOf Function.
Y = TextBox2.Text.IndexOf(".", X)
Again ... the above line means : Locate the (.) symbol that comes after the (@) .
The line If Y < 1, Then means that if the user wrote the (.) at the first letter Zero position then the application will generate a message box, then End If to end the IF Statement that belongs to locating the @ symbol.
MsgBox ("Invalid E-mail Address")
End If
Else the (@) at the (0) position
MsgBox ("Invalid E-mail Address")
End If 
End checking for (@) Locations it is after the (0) position already .
End Sub
Visual Basic OOP [Classes Intro] Homework :
(1) Please Design this Project On your own and notice how Email forms must be exactly typed as conditioned, and why (-1) shows sometimes !!??

(2) Where to write a message box that tells the user the the Email format is correct ?
Next Lesson - OOP Classes further Look

Here are some online Visual Basic lessons and courses :

OOP Toturial Index Polymorphism VB 2010 VB 2010 Optimization object oriented programming OOP Crystal Report Freelance Optimization VB 2010 MS-Access 2003/2007 ADO.Net visual basic course Crystal report and VB .net Earn money programming - Programmer Jobs Online Online courses VB2010 Receive E-mail Search Optimization Sql Server Visual Basic Visual Basic 2010 online courses Visual Basic Job online visual basic courses pop server pop3 visual basic courses online visual basic online courses ADO.Net online mode Insert Date into SqlServer using VB.Net Install Crystal report No error message available SqlServer VB 2010 DataGridView Visual Basic .Net and SQL Server Date-Time Visual Basic .net Visual Basic Class connecting to access database via dao using database e-mail .net framework 4.5.2 Activate Visual Studio 2005 Advantage Data Dictionary Advantage Database Visual Basic 2010 Binary Diff Buttons sound in VB 2010 CR for VS2015 CRforVS2015 Check internet connection Command Prompt Communicate with a client Compare two applications Compare two strings and return differences Compare two treeviews Conversion from type 'DBNull' to type 'String' is not valid Crystal Report with Protected MS-Access database DAO + VB .NET + ACCESS DataGridView VB 2010 Programming DataGridView with MS-Access DataReader DevExpress 12.2.9 Serial crack full DevExpress VB.Net DevExpress full Download DevExpress 12 Dxperience 12.2.4 Dxperience full serial crack Event Planning Example on connecting to Advantage Data Dictionary from VB.Net FC Command Fade Image VB 2010 MS Access 2010 MS SQL SERVER 2000 INSTALLATION MS VB.Net MS-Access 2007 2010 MS-Access Compact and Repair from VB 2010 Programmatically Make sure application is running Microsoft Visual Basic .Net Math Functions list OOP Lesson 11 OOP Lesson 12 OOP Lesson 6 OOP Lesson 7 OOP Lesson 8 OOP Lesson 9 OOP Lesson13 OOPTutorials POP3 Commands in VB 2010 Point of sale application Purchase Receive E-mail from Gmail in VB 2010 Requirement Doc Reverse Strings SQL Server 2000 SQL Server 2000 date-time type Sales and Stores application Source code download Sql Server and VB.Net The Microsoft.ACE.OLEDB.12.0 provider is not registered on the local machine The following control could not be licensed There is already an open DataReader associated with this Command which must be closed first Toolbox items Topmost - Inputbox Sloved Tx TxtControl for Visual Basic Use case definition VB 2005 Activation Code VB 2010 Compare and return differences VB 2010 Create Controls at Run-Time with events VB 2010 How to fade Image VB 2010 Internet VB 2010 Read Text Files VB 2010 Reverse Strings VB 2010 check for internet connection VB 2010 database compact and repair VB 2010 progressbar VB.Net Math functions VB.Net Search Optimization SqlServer 2000 lessons VB2010 VS 2051 VS2010 VS2015 VS2017 VS2019 Virus W32.Sality Visual Basic Application Development Visual Basic Virus Visual Studio Serial Number book classes vb compare windows applications and return the difference. crystalDecision older version download crystal report for VB 2010 dtSearch dtSearch Engine dtSearch Engine download full free free make sure application is installed object oriented programming languages oop Lesson 10 play sounds in Visual progress bar result code: DB_SEC_E_AUTH_FAILED(0x80040E4D). sqlserver2000 project (new-save-edit-delete) the application failed to initialize properly 0xc000007b tutorials vb .Net functions list. vb 2010 Create TextBox with events at Project Runtime vb 2010 receive Emails visual basic .Net FlexGrid visual basic courses win10 32 bit solution برنامج المشتريات و المبيعات و المخازن
Show more