Search VB 2010

Tuesday, April 12, 2011

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.


OOP

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 :
Form1
Name : Form1
Label
Name : Label1
Text : Name
Label
Name : Label2
Text : E-mail
TextBox
Name : TxtName
TextBox
Name : TxtEmail
Button
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 :

38 comments:

  1. Create a decorative cake that's that little bit more special is a lot more difficult these days as there are higher standards to be met. Ben 10 is an animated American television series following the adventures of Ben Tennyson, an ordinary boy who enjoys daily encounters with aliens. During the heady days of the Roman Empire, wedding guests were served not one cake but a sumptuous collection of many small treats and pastries as a kind of wedding party favor.

    Also visit my blog :: Birthday Cake Decor Ideas Photograph

    ReplyDelete
  2. The tea made up for the calories she had cut out from fast food and
    she wasn. Regular walking is known to be a good cardiovascular exercise.
    Visiting your doctor is like getting a second opinion regarding the choice
    you're about to make.

    My homepage; easy diet Plans

    ReplyDelete
  3. I blog quite often and I truly appreciate your information.
    This article has really peaked my interest. I'm going to bookmark your website and keep checking for new details about once per week. I subscribed to your Feed too.

    My website; quantrim - -

    ReplyDelete
  4. If you are overweight, compared to where you should be, then the doctor will probably help you put together a plan.
    And, it's a product has some clinical results under its belt. A healthy weight loss has to be very easy and hassle-free.

    my webpage: lose weight fast dvd - -

    ReplyDelete
  5. I have attempted for that past 35 years to remove and Continue to maintain OFF
    my belly excess fat. I've attempted anything from eating plan program tablets, private trainers, each eating approach ever proposed, I at present invest on two wellness club memberships, at any offered time, and in addition have not had the time to advantage from the advantages of the two 1 amid them in over a yr. I have to state that only stage that assisted me ways to lose weight without exercise hoping the ambiance, ease as well as the availability from the facilities getting opened from five:00a.m correct up till ten:00pm would encourage me to stay on course, attend a number of the cardio lessons, aquatics lessons, phase lessons etc…

    Here is my web blog :: lose weight quickly week

    ReplyDelete
  6. If you add peanut butter and bird seed towards the pine cones the birds will value it.
    Accessorizing your trees with cards, snow, Christmas lights and hand made
    angels would generate a fascinating appear in your Xmas tree.
    Employers pull workers from other actions to devote worthwhile time untangling strings of lighting &
    hanging wreaths.

    Visit my page; elegant exterior christmas decorations :: www.ideasforchristmasdecorating.com ::

    ReplyDelete
  7. I have learn several excellent stuff here. Definitely value bookmarking for revisiting.
    I wonder how so much effort you place to make this
    type of fantastic informative web site.

    Here is my blog :: ingredients of quantrim

    ReplyDelete
  8. An interesting discussion is definitely worth comment.
    There's no doubt that that you should publish more about
    this issue, it may not be a taboo subject but usually people do not
    speak about these subjects. To the next! Best
    wishes!!

    Here is my website qantrim ()

    ReplyDelete
  9. My family all the time say that I am wasting my time here at net, except I know I am getting familiarity every day by reading
    thes good posts.

    Also visit my web page weight loss

    ReplyDelete
  10. each time i used to read smaller articles which as well clear their motive, and that
    is also happening with this piece of writing which I am reading at this place.


    my website http://tokyofuns.com/wiki/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:RudolphDelatorr

    ReplyDelete
  11. A good alternative in this type of situation would be to hang a smart kitchen valance from the
    top part of the window and perhaps a matching caf.
    Retains forks, cutlery, spoons, sporks, and also your red rooster metallic paper towel holder if you get rid of the base part.
    Some kitchen colour schemes have remained well-liked over time.


    Here is my web page: Remodeling Small Kitchen Ideas Photograph

    ReplyDelete
  12. Give prominence and importance to dissimilar angles
    and place the lights properly. But having direct sunlight is the best source.
    The strength and beauty of wrought iron planter make them one of the
    most sought after decorative pieces.

    Here is my page ... free backyard garden ideas

    ReplyDelete
  13. Ikea is a huge chain of home decorating stores, but is only in a select few American cities.

    Custom invitations can be costly, but you can save cash and
    add your personal touch by creating your own. Irish
    Soda bread will be a new recipe for your guests to try and it will most likely
    be a big hit.

    Here is my website: princess party decoration ideas ()

    ReplyDelete
  14. Since Christmas is also fast approaching, ladies can stock up favorite brand apparels and accessories in advance.
    One other quick, easy, and messy idea is to fill a dixie type, cardboard cup with lard,
    melt this in the microwave. A few even go for
    custom-made prams because they can adjust the seat very easily.


    Look at my webpage homemade christmas ideas for
    men (http://www.xmasdecor.org/ideas/preview/2532/18homemadechristmasgiftsforkidstomakegreatideasforgifts.html)

    ReplyDelete
  15. If you wish tο win heг forgiveness without having to feel ashamed or sϲared, ʏou can always write these
    sorry letters. " Geno asked as he was studying his 8 footer for birdie. A good quality bed suitable for the couple is an essential commodity; it can have a side cupboard for keeping the mobile phones, telephone diary, a note book, a pen and an alarm clock.

    Also visit my website: pain gone pen nz ()

    ReplyDelete
  16. If you are going for finest contents like I do, simply pay a visit this web page all the time since it presents
    quality contents, thanks

    Also visit my web site - http://www.youtube.com/watch?v=s9jPBXN9a2g

    ReplyDelete
  17. Flower seeds can bee added to the mix as well and would work well
    with dsarf zinnias, marigold and bright pansies
    ' but what you add it up to you. The three of us, plus my wife and kids, made the work so
    much easier and faster. First you must take care of the physical parts of
    the house, such as shape, size and color.

    my web page - indoor discovering different types greenhouses fairy garden ideas ()

    ReplyDelete
  18. Thus, there are no protrusions on the earth, and
    trenches do not have to be created. The possibilities, many and various, obtaining astounding results, I have
    found that there are so many people with wonderful ideas, provided, to
    share on the internet. Deciduous trees provide shade during
    warmer months, when they are in full bloom, and allow the heat of the sun to your home during winter months, when they
    have shed their leaves.

    Take a look at my web blog: small garden landscape design photos patios

    ReplyDelete
  19. During this time, it is recommended that the pott be removed from
    thee water to avokid breaking. Once youu add the edging you will have an attractive
    area to show offf with pride. In landscape art the horizon is a line,
    sometimes drawn, sometimes implied, that suggests the separation between earth and sky.


    Here is my blog post ... how to make whimsical garden decorations

    ReplyDelete
  20. Thus, make sure that the garden is properly positioned in an area that has both
    sun and shade, and that it has a nice little fence so that animals cannot get into it.
    A water feature adds coolness and auditory pleasure with the
    sound of tinkling or running water. Unless you have experience in designing a landscaping plan, it is best to contact a lkcal landscape designer, or nursery, for assistance in the design lay-out of your
    landscape and garden.

    Also visit my web page; succulent rock garden ideas

    ReplyDelete
  21. You will open up up many different tables in several windows with your personal pc screens and perform all
    of them concurrently. This free money can even be used for building infrastructure of education these students will need and spread
    the process of education worldwide. If a human being can do it, our software application can do it (therefore its
    name).

    Feel free to surf to my blog post: facebook password hacker

    ReplyDelete
  22. When it comes to a garden, it is all about the flowers and plants.
    Non-native poants tenmd to be high maintenance
    depending on lots of water and insecticides to survive.
    In landscape art the horizon is a line, sometimes drawn, sometimes implied, that suggests the separation between earth
    and sky.

    Here is my weblog :: Outdoor garden Decor

    ReplyDelete
  23. Thus, there are no protrusions on the earth, and trenches do not have
    to be created. There are many ways you can plan and design your landscape.
    Deciduous trees provide shade during warmer months, when they
    are in full bloom, and allow the heat of the sun to your home during winter months, when they have shed their leaves.


    my webpage ohio ohio rain garden design

    ReplyDelete
  24. You will open up up many different tables in several windows with your personal pc
    screens and perform all of them concurrently.
    Your browser accepts that certificate, because it has been issued by a trustworthy certificate authority.
    The website is quite professional in nature Facebook Password
    Finder you can easily order this sinister support.


    Also visit my webpage; facebook password hacker

    ReplyDelete
  25. Mowing around such edgings can be problematic or impossible.
    Your customers must trust in every factor that you do for them.
    Deciduous trees provide shade during warmer months, when they are in full bloom, and allow the heat oof the sun to your home during winter months,
    when they have shed their leaves.

    Here is my site: english garden design

    ReplyDelete
  26. Mowing around such edgings can be problematic or impossible.
    A water feature adeds coolness and auditory pleasure with the sound of tinkling or running water.

    Taking old containers and giving them new life with a
    fresh coat of paint can add additional collr to any garden.

    Feel free to visit my blog post; rain garden how to design roof trusses

    ReplyDelete
  27. Warm season vegetables and cold season vegetables need to be planted at the appropriate times.
    A water feature adds coolness and auditory pleasure with the sound of tinkling or running water.
    There are an estimated 20,000 private water mill sites in the
    country, of which only a few dozen have installed turbine generators.



    Here is my site ... Simple Flower Garden Ideas

    ReplyDelete
  28. You will open up up many different tables in several windows with your personal
    pc screens and perform all of them concurrently. Of course,
    Major 12 Compromise Major 10 footballing administrator Tokens compromise major 14 hack creator meets flawlessly to the JTB-Guide-Dog model.
    You by now know how foolish Google are, if not this is a doosey.


    Review my weblog: hack facebook password 2014

    ReplyDelete
  29. During this time, it is recommended that the pot be removed from the water to avoid breaking.

    The possibilities, many and various, obtaining astounding results, I have found that there are so many people with wonderful ideas, provided, to share on the internet.
    First you must take care of the physical parts of the house, such as shape,
    size and color.

    my homepage - tyler rose garden texas

    ReplyDelete
  30. You need to also match your preferences in colors on your crops
    and be sure that they mix in with general layout of the garden at the same time as its landscape.

    There are many ways you can plan and design your landscape.

    Taking old containers and giving them new life with a fresh coat of paint
    can add additional color to any garden.

    My web blog :: easy flower garden ideas

    ReplyDelete
  31. With well over 535 million potential victims of having their personal information compromised, the cost of
    a breach to a company averaging over $7. Others can find
    the exact programs they need by shopping at the
    same retailer where they bought their systems. You by now know how foolish Google
    are, if not this is a doosey.

    Review my web site facebook password hacker

    ReplyDelete
  32. Mowing around such edgings can be problematic
    or impossible. Non-native plants tend tto be high
    maintenance depending on lots of water and insecticides to survive.
    Taking old containers and giving them new life with a fresh
    coat of paint can add additional color to any garden.

    my web-site - free backyard garden ideas

    ReplyDelete
  33. It's a shame you don't have a donate button! I'd without a doubt donate to this superb blog!
    I guess for now i'll settle for book-marking and
    adding your RSS feed to my Google account. I look forward
    to brand new updates and will talk about this website with my Facebook group.
    Chat soon!

    My website :: clash of clans hack

    ReplyDelete
  34. The article is in reality the excellent on this worthy topic.
    I match in with your conclusions and looking forward to your coming updates.
    Just saying thanks won't just be sufficient, for that fantastic clarity in your writing.
    I've grabbed your rss feed to remain informed of any updates.
    Gratifying perform and considerably success inside your
    business dealings!

    My web blog :: nike hyperdunk

    ReplyDelete

Visual Basic Online Course

Visual Basic Courses - Share