Visual Basic Online Course - OOP
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
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 .
- Project Design [GUI]
Name : Form1Label
Name : Label1Label
Text : Name
Name : Label2TextBox
Text : E-mail
Name : TxtNameTextBox
Name : TxtEmailButton
Name : BtnValidNow, what does it mean (Make sure the user writes E-mail address format correctly or in Email format)??
Text : Validate E-mail
- 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?!
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?!
Again, the line of code means (Locate the position of the (@) Character within the property Text in the Control TxtEmail, Please) ...
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)
MsgBox ("Invalid E-mail Address")
MsgBox ("Invalid E-mail Address")
(1) Please Design this Project On your own and notice how Email forms must be exactly typed as conditioned, and why (-1) shows sometimes !!??Next Lesson - OOP Classes further Look
(2) Where to write a message box that tells the user the the Email format is correct ?
♥ Here are some online Visual Basic lessons and courses :
- Visual Basic .Net snippets collection
- Visual Basic .Net - How to check for the internet connection
- Visual Basic .Net - POP3 and Receiving E-mails
- Visual Basic .Net - Generate Random Combinations
- Visual Basic .Net - Play sounds on Button Click or Mouse Hover
- Visual Basic .Net - Progressbar control
- Visual Basic .Net Solution - The application failed to initialize
- Visual Basic .Net - Working with Database full example
- Visual Basic .Net - There is already an open DataReader associated
- Visual Basic .Net - SyBase Advantage Database [Add, Edit, Search, Delete and DataGridView]
- Visual Basic .Net - Math Functions
- Visual Basic .Net - Communicating with clients [Requirements Docs, Use-Case]
- Visual Basic .Net - Command Prompt Read/Write
- Visual Basic .Net - Crystal Reports 2010 for Visual Basic .Net
- Visual Basic .Net - Fade Image
- Visual Basic .Net - Free POS System Project Source Code