SlideShare une entreprise Scribd logo
1  sur  27
Implementing Object Oriented Programming
In Visual Basic.NET

Pre-Assessment Questions
    •    Consider the following statements:
         • Statement A: There are two types of user interfaces, character user
             interface and (CUI) and graphical user interface (GUI).
         • Statement B: In CUI, you can interact with an application by entering
             commands.
         Which of the following is correct with respect to the above statements?
         d.  Both, Statement A and Statement B, are False.
         e.  Both, Statement A and Statement B, are True.
         f.  Statement A is True and Statement B is False.
         g.  Statement A is False and Statement B is True.




 ©NIIT                  Introduction to VB.NET            Lesson 2A / Slide 1 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

Pre-Assessment Questions (Contd.)
    2. Which of the statements is false?
        •    A Windows Form is a representation of any window displayed in an
             application.
        •    Windows form properties are used to determine its appearance at
             compile time.
        •    Every Window Form is a class derived from Form class in
             System.Windows.Forms namespace.
        •    The form class is derived from the control class.




 ©NIIT                  Introduction to VB.NET            Lesson 2A / Slide 2 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

Pre-Assessment Questions (Contd.)
    3.   Which of the following data types can contain values between 0 and 65535?
          •   Boolean
          •   String
          •   Char
          •   Decimal

    •    In the following code
                           Dim Result as Boolean
                           Result = X<Y
         •    The Result will have the true value
         •    The Result will have false value
         •    The Result will have either true or false value
         •    The Result will have no value



 ©NIIT                    Introduction to VB.NET                Lesson 2A / Slide 3 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

Pre-Assessment Questions (Contd.)
    5. Data types like Boolean,String or Integer are
        •     Composite data types
        •     System data types
        •     Object data types
        •     Array data types




 ©NIIT                   Introduction to VB.NET        Lesson 2A / Slide 4 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

Solutions to Pre-Assessment
  Questions
    •    b.
    •    b.
    •    c. Char
    •    a.
    •    b. System data type




 ©NIIT                  Introduction to VB.NET   Lesson 2A / Slide 5 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

Objectives
    In this lesson, you will learn to:
         • Identify classes and objects
         • List the advantages of using classes and objects
         • Declare and import namespaces
         • Implement abstract classes in Visual Basic .NET
         • Declare structures and interfaces
         • Create and instantiate a class
         • Create an inherited form in Visual Basic .NET
         • Implement inheritance in VB .NET




 ©NIIT                   Introduction to VB.NET               Lesson 2A / Slide 6 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

Understanding Object-Orientation
Concepts
    •    Visual Basic.Net is an object-oriented programming language.
    •    Visual Basic .NET supports all the four features of object-oriented
         programming.
    •    The features of object-oriented programming are
           • Encapsulation
           • Abstraction
           • Inheritance
           • Polymorphism.




 ©NIIT                      Introduction to VB.NET              Lesson 2A / Slide 7 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

Understanding Classes
         •   A class is a conceptual representation of all the entities that share
             common attributes and behaviors.




 ©NIIT                     Introduction to VB.NET               Lesson 2A / Slide 8 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

Object
    •    An object is an instance of a class
    •    All the objects of a class have individual copies of the attributes and share a
         common set of behaviors




 ©NIIT                      Introduction to VB.NET              Lesson 2A / Slide 9 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

Advantages of Using Classes and
 Objects
    •    Maintenance of code by introducing modularity
    •    Encapsulation of internal complexities in code from end-users
    •    Reusabilty
    •    Support for a single interface to implement multiple methods




 ©NIIT                     Introduction to VB.NET            Lesson 2A / Slide 10 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

 Constructors
    •    Constructors are special methods that allow control over the initialization of
         objects.
    •    A shared constructor will not run more than once during a single execution of a
         program.
    •    When an instance of a class is created, the run-time environment executes the
         instance constructors.




 ©NIIT                     Introduction to VB.NET            Lesson 2A / Slide 11 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

Destructors
    •    Destructors are special methods that are used to release the instance of a
         class from memory.
    •    There are two types of destructors in Visual Basic .NET, Finalize() and
         Dispose().
    •    The sequences in which the constructors and destructors are invoked are:
           • Shared constructor of the inherited class
           • Shared constructor of the base class
           • Instance constructor of the base class
           • Instance constructor of the inherited class




 ©NIIT                     Introduction to VB.NET            Lesson 2A / Slide 12 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

Namespaces
    •    Namespaces enable you to avoid name collisions.
    •    Every project in Visual Basic .NET has a root namespace, which is set in the
         Property page of the project Using Namespaces.
    •    You can also organize classes using the Namespace keyword as shown below.
                Namespace CustNameSpace
                Class CustClass
                End Class
                End Namespace
    •    You can use namespaces explicitly through direct addressing or implicitly
         through the Imports statement.




 ©NIIT                     Introduction to VB.NET            Lesson 2A / Slide 13 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

 Abstract Classes in Visual Basic .NET
    •    Visual Basic .NET enables you to create abstract classes that contain the
         skeleton of the methods implemented by the derived class.




 ©NIIT                     Introduction to VB.NET             Lesson 2A / Slide 14 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

Understanding Structures
    •     A structure is used to create user-defined data types.
    •     You can declare a structure when you want a single variable to hold multiple
         types of related data.
    •    Data can be stored in and retrieved from a structure.




 ©NIIT                     Introduction to VB.NET            Lesson 2A / Slide 15 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

Interfaces in Visual Basic.NET
    •    Interfaces are inheritable in Visual Basic.Net.
    •    An interface defines properties, methods, and events.
    •    You declare an interface using the Interface and End Interface statements.
    •    You can declare only methods, functions, properties, and events in an
         interface.




 ©NIIT                     Introduction to VB.NET            Lesson 2A / Slide 16 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

Interfaces in Visual Basic.NET(Contd.)
    •    An interface can inherit members from an existing interface
    •    The members of an interface consist of the declared members and the
         members inherited from its base interfaces.




 ©NIIT                    Introduction to VB.NET           Lesson 2A / Slide 17 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

 Inheritance
    •    The inheritance feature allows you to define a new class by extending an
         existing class.




 ©NIIT                     Introduction to VB.NET            Lesson 2A / Slide 18 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

Polymorphism
    •    The concept of using operators or functions in different ways depending on
         what they are operating on is called polymorphism.




 ©NIIT                     Introduction to VB.NET            Lesson 2A / Slide 19 of 27
Implementing Object Oriented Programming
In Visual Basic.NET




                Demo for
   Creating a Class in Visual Basic.Net




 ©NIIT        Introduction to VB.NET   Lesson 2A / Slide 20 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

Problem Statement
    •    A company called Protec Inc. needs to maintain customer information. The
         details of the customer need to be accepted through a graphical interface. The
         user interface can be either Windows Forms, Web Forms, or Console. The
         customer information also needs to be stored in relevant memory variables of
         a class. The information should also be retrieved and displayed to the user.
         The details of the customer will include CustomerID, First Name, Last
         Name, Address, Telephone number and E-mail Id.




 ©NIIT                     Introduction to VB.NET            Lesson 2A / Slide 21 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

Solution
    •    A user interface screen is used to accept data from the user and displaying
         data to the user. A class can be used to store and retrieve data from the
         database. Perform the following steps to create a class:
           • Create a user interface.
           • Adding a class to the project
           • Write the code to store and retrieve data from the class
           •  Save and run the application




 ©NIIT                     Introduction to VB.NET            Lesson 2A / Slide 22 of 27
Implementing Object Oriented Programming
In Visual Basic.NET




                Demo for
         Implementing Inheritance




 ©NIIT        Introduction to VB.NET   Lesson 2A / Slide 23 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

Problem Statement
    •    The company Protec Inc needs data entry forms to store information in the
         Customers, Orders, and Query Handling databases. The data entry forms
         should have a similar user interface with the Reset and Exit buttons.
         Incorporate the interface for the Order details form.




 ©NIIT                    Introduction to VB.NET          Lesson 2A / Slide 24 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

Solution
    •    To create the user interface form you need to perform the following steps:
           • Create the user interface screen
           • Add code for the controls
           • Create an inherited form based on the base form
           • Add an inherited form to the project
           • Add the additional user interface control
           • Display a similar user interface
           • Add code for the inherited controls
           • Save and Execute the application




 ©NIIT                     Introduction to VB.NET            Lesson 2A / Slide 25 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

Summary
    In this lesson, you learned that:
    • Visual Basic .NET is an object-oriented programming language
    • Classes can be added to a Visual Basic .NET project
    • An object is an instance of a class
    • Advantages of Using Classes and Objects
          • Maintenance of code
          • Encapsulation
          • Reusabilty
          • Support for a single interface to implement multiple methods
    • Constructors are special methods that allow control over the initialization of
        objects.
    • Destructors are special methods that are used to release the instance of a
        class from memory.



 ©NIIT                    Introduction to VB.NET            Lesson 2A / Slide 26 of 27
Implementing Object Oriented Programming
In Visual Basic.NET

Summary (Contd.)
    •    An important advantage of using a namespace is the prevention of a name
         collision
    •    Abstract classes are used to define the skeleton of the methods that the
         derived class can implement.
    •    A structure is used to create user-defined data types.
    •    An interface enables you to separate the definition of objects from their
         implementation so that the objects can evolve without the risk of introducing
         incompatibility in existing applications.
    •    The inheritance feature allows you to define a new class by extending an
         existing class
    •    The concept of using operators or functions in different ways depending on
         what they are operating on is called polymorphism.
    •    Interfaces and classes are inheritable in Visual Basic .NET




 ©NIIT                     Introduction to VB.NET            Lesson 2A / Slide 27 of 27

Contenu connexe

En vedette

Concepts In Object Oriented Programming Languages
Concepts In Object Oriented Programming LanguagesConcepts In Object Oriented Programming Languages
Concepts In Object Oriented Programming Languagesppd1961
 
Objects and classes in Visual Basic
Objects and classes in Visual BasicObjects and classes in Visual Basic
Objects and classes in Visual BasicSangeetha Sg
 
Modelos de desarrollo de aplicaciones web
Modelos de desarrollo de aplicaciones webModelos de desarrollo de aplicaciones web
Modelos de desarrollo de aplicaciones webYaskelly Yedra
 
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...Isuru Perera
 
Part 3 binding navigator vb.net
Part 3 binding navigator vb.netPart 3 binding navigator vb.net
Part 3 binding navigator vb.netGirija Muscut
 
Vb.net session 15
Vb.net session 15Vb.net session 15
Vb.net session 15Niit Care
 
Transforming the world with Information technology
Transforming the world with Information technologyTransforming the world with Information technology
Transforming the world with Information technologyGlenn Klith Andersen
 
What&rsquo;s new in Visual C++
What&rsquo;s new in Visual C++What&rsquo;s new in Visual C++
What&rsquo;s new in Visual C++Microsoft
 
Part 5 create sequence increment value using negative value
Part 5 create sequence increment value using negative valuePart 5 create sequence increment value using negative value
Part 5 create sequence increment value using negative valueGirija Muscut
 
Part 8 add,update,delete records using records operation buttons in vb.net
Part 8 add,update,delete records using records operation buttons in vb.netPart 8 add,update,delete records using records operation buttons in vb.net
Part 8 add,update,delete records using records operation buttons in vb.netGirija Muscut
 
Python Tools for Visual Studio: Python na Microsoftovom .NET-u
Python Tools for Visual Studio: Python na Microsoftovom .NET-uPython Tools for Visual Studio: Python na Microsoftovom .NET-u
Python Tools for Visual Studio: Python na Microsoftovom .NET-uNikola Plejic
 
How Not To Be Seen
How Not To Be SeenHow Not To Be Seen
How Not To Be SeenMark Pesce
 
Part 1 picturebox using vb.net
Part 1 picturebox using vb.netPart 1 picturebox using vb.net
Part 1 picturebox using vb.netGirija Muscut
 
Prolog -Cpt114 - Week3
Prolog -Cpt114 - Week3Prolog -Cpt114 - Week3
Prolog -Cpt114 - Week3a_akhavan
 
Cognitive information science
Cognitive information scienceCognitive information science
Cognitive information scienceS. Kate Devitt
 
Part2 database connection service based using vb.net
Part2 database connection service based using vb.netPart2 database connection service based using vb.net
Part2 database connection service based using vb.netGirija Muscut
 

En vedette (19)

Concepts In Object Oriented Programming Languages
Concepts In Object Oriented Programming LanguagesConcepts In Object Oriented Programming Languages
Concepts In Object Oriented Programming Languages
 
Objects and classes in Visual Basic
Objects and classes in Visual BasicObjects and classes in Visual Basic
Objects and classes in Visual Basic
 
Modelos de desarrollo de aplicaciones web
Modelos de desarrollo de aplicaciones webModelos de desarrollo de aplicaciones web
Modelos de desarrollo de aplicaciones web
 
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...
 
Part 3 binding navigator vb.net
Part 3 binding navigator vb.netPart 3 binding navigator vb.net
Part 3 binding navigator vb.net
 
Presentation1
Presentation1Presentation1
Presentation1
 
Vb.net session 15
Vb.net session 15Vb.net session 15
Vb.net session 15
 
Transforming the world with Information technology
Transforming the world with Information technologyTransforming the world with Information technology
Transforming the world with Information technology
 
What&rsquo;s new in Visual C++
What&rsquo;s new in Visual C++What&rsquo;s new in Visual C++
What&rsquo;s new in Visual C++
 
Part 5 create sequence increment value using negative value
Part 5 create sequence increment value using negative valuePart 5 create sequence increment value using negative value
Part 5 create sequence increment value using negative value
 
Part 8 add,update,delete records using records operation buttons in vb.net
Part 8 add,update,delete records using records operation buttons in vb.netPart 8 add,update,delete records using records operation buttons in vb.net
Part 8 add,update,delete records using records operation buttons in vb.net
 
Python Tools for Visual Studio: Python na Microsoftovom .NET-u
Python Tools for Visual Studio: Python na Microsoftovom .NET-uPython Tools for Visual Studio: Python na Microsoftovom .NET-u
Python Tools for Visual Studio: Python na Microsoftovom .NET-u
 
How Not To Be Seen
How Not To Be SeenHow Not To Be Seen
How Not To Be Seen
 
Part 1 picturebox using vb.net
Part 1 picturebox using vb.netPart 1 picturebox using vb.net
Part 1 picturebox using vb.net
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Information Overload and Information Science / Mieczysław Muraszkiewicz
Information Overload and Information Science / Mieczysław MuraszkiewiczInformation Overload and Information Science / Mieczysław Muraszkiewicz
Information Overload and Information Science / Mieczysław Muraszkiewicz
 
Prolog -Cpt114 - Week3
Prolog -Cpt114 - Week3Prolog -Cpt114 - Week3
Prolog -Cpt114 - Week3
 
Cognitive information science
Cognitive information scienceCognitive information science
Cognitive information science
 
Part2 database connection service based using vb.net
Part2 database connection service based using vb.netPart2 database connection service based using vb.net
Part2 database connection service based using vb.net
 

Similaire à Vb.net session 03

Vb net xp_03
Vb net xp_03Vb net xp_03
Vb net xp_03Niit Care
 
Vb.net session 04
Vb.net session 04Vb.net session 04
Vb.net session 04Niit Care
 
Vb.net session 09
Vb.net session 09Vb.net session 09
Vb.net session 09Niit Care
 
Vb.net session 13
Vb.net session 13Vb.net session 13
Vb.net session 13Niit Care
 
10265 developing data access solutions with microsoft visual studio 2010
10265 developing data access solutions with microsoft visual studio 201010265 developing data access solutions with microsoft visual studio 2010
10265 developing data access solutions with microsoft visual studio 2010bestip
 
Vb.net session 02
Vb.net session 02Vb.net session 02
Vb.net session 02Niit Care
 
Csc253 chapter 09
Csc253 chapter 09Csc253 chapter 09
Csc253 chapter 09PCC
 
Introduction to vb.net
Introduction to vb.netIntroduction to vb.net
Introduction to vb.netJaya Kumari
 
Vb net xp_01
Vb net xp_01Vb net xp_01
Vb net xp_01Niit Care
 
Vb.net session 10
Vb.net session 10Vb.net session 10
Vb.net session 10Niit Care
 
04 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_0504 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_05Niit Care
 
Asp.NETZERO - A Workshop Presentation by Citytech Software
Asp.NETZERO - A Workshop Presentation by Citytech SoftwareAsp.NETZERO - A Workshop Presentation by Citytech Software
Asp.NETZERO - A Workshop Presentation by Citytech SoftwareRitwik Das
 
c#.Net Windows application
c#.Net Windows application c#.Net Windows application
c#.Net Windows application veera
 

Similaire à Vb.net session 03 (20)

Vb net xp_03
Vb net xp_03Vb net xp_03
Vb net xp_03
 
Vb.net session 04
Vb.net session 04Vb.net session 04
Vb.net session 04
 
Vb.net session 09
Vb.net session 09Vb.net session 09
Vb.net session 09
 
Ajs 1 b
Ajs 1 bAjs 1 b
Ajs 1 b
 
Ajs 3 c
Ajs 3 cAjs 3 c
Ajs 3 c
 
Vb.net session 13
Vb.net session 13Vb.net session 13
Vb.net session 13
 
10265 developing data access solutions with microsoft visual studio 2010
10265 developing data access solutions with microsoft visual studio 201010265 developing data access solutions with microsoft visual studio 2010
10265 developing data access solutions with microsoft visual studio 2010
 
Ajs 2 b
Ajs 2 bAjs 2 b
Ajs 2 b
 
Vb.net session 02
Vb.net session 02Vb.net session 02
Vb.net session 02
 
Grade 9 COMPUTER
Grade 9 COMPUTERGrade 9 COMPUTER
Grade 9 COMPUTER
 
Csc253 chapter 09
Csc253 chapter 09Csc253 chapter 09
Csc253 chapter 09
 
Introduction to vb.net
Introduction to vb.netIntroduction to vb.net
Introduction to vb.net
 
Vb net xp_01
Vb net xp_01Vb net xp_01
Vb net xp_01
 
Dacj 1-1 c
Dacj 1-1 cDacj 1-1 c
Dacj 1-1 c
 
Vb.net session 10
Vb.net session 10Vb.net session 10
Vb.net session 10
 
04 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_0504 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_05
 
Asp.NETZERO - A Workshop Presentation by Citytech Software
Asp.NETZERO - A Workshop Presentation by Citytech SoftwareAsp.NETZERO - A Workshop Presentation by Citytech Software
Asp.NETZERO - A Workshop Presentation by Citytech Software
 
Ajs 3 a
Ajs 3 aAjs 3 a
Ajs 3 a
 
c#.Net Windows application
c#.Net Windows application c#.Net Windows application
c#.Net Windows application
 
About .net
About .net About .net
About .net
 

Plus de Niit Care (20)

Ajs 4 b
Ajs 4 bAjs 4 b
Ajs 4 b
 
Ajs 4 a
Ajs 4 aAjs 4 a
Ajs 4 a
 
Ajs 4 c
Ajs 4 cAjs 4 c
Ajs 4 c
 
Ajs 3 b
Ajs 3 bAjs 3 b
Ajs 3 b
 
Ajs 1 a
Ajs 1 aAjs 1 a
Ajs 1 a
 
Ajs 1 c
Ajs 1 cAjs 1 c
Ajs 1 c
 
Dacj 4 2-c
Dacj 4 2-cDacj 4 2-c
Dacj 4 2-c
 
Dacj 4 2-b
Dacj 4 2-bDacj 4 2-b
Dacj 4 2-b
 
Dacj 4 2-a
Dacj 4 2-aDacj 4 2-a
Dacj 4 2-a
 
Dacj 4 1-c
Dacj 4 1-cDacj 4 1-c
Dacj 4 1-c
 
Dacj 4 1-b
Dacj 4 1-bDacj 4 1-b
Dacj 4 1-b
 
Dacj 4 1-a
Dacj 4 1-aDacj 4 1-a
Dacj 4 1-a
 
Dacj 1-2 b
Dacj 1-2 bDacj 1-2 b
Dacj 1-2 b
 
Dacj 1-3 c
Dacj 1-3 cDacj 1-3 c
Dacj 1-3 c
 
Dacj 1-3 b
Dacj 1-3 bDacj 1-3 b
Dacj 1-3 b
 
Dacj 1-3 a
Dacj 1-3 aDacj 1-3 a
Dacj 1-3 a
 
Dacj 1-2 c
Dacj 1-2 cDacj 1-2 c
Dacj 1-2 c
 
Dacj 1-2 a
Dacj 1-2 aDacj 1-2 a
Dacj 1-2 a
 
Dacj 1-1 b
Dacj 1-1 bDacj 1-1 b
Dacj 1-1 b
 
Dacj 1-1 a
Dacj 1-1 aDacj 1-1 a
Dacj 1-1 a
 

Dernier

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 

Dernier (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Vb.net session 03

  • 1. Implementing Object Oriented Programming In Visual Basic.NET Pre-Assessment Questions • Consider the following statements: • Statement A: There are two types of user interfaces, character user interface and (CUI) and graphical user interface (GUI). • Statement B: In CUI, you can interact with an application by entering commands. Which of the following is correct with respect to the above statements? d. Both, Statement A and Statement B, are False. e. Both, Statement A and Statement B, are True. f. Statement A is True and Statement B is False. g. Statement A is False and Statement B is True. ©NIIT Introduction to VB.NET Lesson 2A / Slide 1 of 27
  • 2. Implementing Object Oriented Programming In Visual Basic.NET Pre-Assessment Questions (Contd.) 2. Which of the statements is false? • A Windows Form is a representation of any window displayed in an application. • Windows form properties are used to determine its appearance at compile time. • Every Window Form is a class derived from Form class in System.Windows.Forms namespace. • The form class is derived from the control class. ©NIIT Introduction to VB.NET Lesson 2A / Slide 2 of 27
  • 3. Implementing Object Oriented Programming In Visual Basic.NET Pre-Assessment Questions (Contd.) 3. Which of the following data types can contain values between 0 and 65535? • Boolean • String • Char • Decimal • In the following code Dim Result as Boolean Result = X<Y • The Result will have the true value • The Result will have false value • The Result will have either true or false value • The Result will have no value ©NIIT Introduction to VB.NET Lesson 2A / Slide 3 of 27
  • 4. Implementing Object Oriented Programming In Visual Basic.NET Pre-Assessment Questions (Contd.) 5. Data types like Boolean,String or Integer are • Composite data types • System data types • Object data types • Array data types ©NIIT Introduction to VB.NET Lesson 2A / Slide 4 of 27
  • 5. Implementing Object Oriented Programming In Visual Basic.NET Solutions to Pre-Assessment Questions • b. • b. • c. Char • a. • b. System data type ©NIIT Introduction to VB.NET Lesson 2A / Slide 5 of 27
  • 6. Implementing Object Oriented Programming In Visual Basic.NET Objectives In this lesson, you will learn to: • Identify classes and objects • List the advantages of using classes and objects • Declare and import namespaces • Implement abstract classes in Visual Basic .NET • Declare structures and interfaces • Create and instantiate a class • Create an inherited form in Visual Basic .NET • Implement inheritance in VB .NET ©NIIT Introduction to VB.NET Lesson 2A / Slide 6 of 27
  • 7. Implementing Object Oriented Programming In Visual Basic.NET Understanding Object-Orientation Concepts • Visual Basic.Net is an object-oriented programming language. • Visual Basic .NET supports all the four features of object-oriented programming. • The features of object-oriented programming are • Encapsulation • Abstraction • Inheritance • Polymorphism. ©NIIT Introduction to VB.NET Lesson 2A / Slide 7 of 27
  • 8. Implementing Object Oriented Programming In Visual Basic.NET Understanding Classes • A class is a conceptual representation of all the entities that share common attributes and behaviors. ©NIIT Introduction to VB.NET Lesson 2A / Slide 8 of 27
  • 9. Implementing Object Oriented Programming In Visual Basic.NET Object • An object is an instance of a class • All the objects of a class have individual copies of the attributes and share a common set of behaviors ©NIIT Introduction to VB.NET Lesson 2A / Slide 9 of 27
  • 10. Implementing Object Oriented Programming In Visual Basic.NET Advantages of Using Classes and Objects • Maintenance of code by introducing modularity • Encapsulation of internal complexities in code from end-users • Reusabilty • Support for a single interface to implement multiple methods ©NIIT Introduction to VB.NET Lesson 2A / Slide 10 of 27
  • 11. Implementing Object Oriented Programming In Visual Basic.NET Constructors • Constructors are special methods that allow control over the initialization of objects. • A shared constructor will not run more than once during a single execution of a program. • When an instance of a class is created, the run-time environment executes the instance constructors. ©NIIT Introduction to VB.NET Lesson 2A / Slide 11 of 27
  • 12. Implementing Object Oriented Programming In Visual Basic.NET Destructors • Destructors are special methods that are used to release the instance of a class from memory. • There are two types of destructors in Visual Basic .NET, Finalize() and Dispose(). • The sequences in which the constructors and destructors are invoked are: • Shared constructor of the inherited class • Shared constructor of the base class • Instance constructor of the base class • Instance constructor of the inherited class ©NIIT Introduction to VB.NET Lesson 2A / Slide 12 of 27
  • 13. Implementing Object Oriented Programming In Visual Basic.NET Namespaces • Namespaces enable you to avoid name collisions. • Every project in Visual Basic .NET has a root namespace, which is set in the Property page of the project Using Namespaces. • You can also organize classes using the Namespace keyword as shown below. Namespace CustNameSpace Class CustClass End Class End Namespace • You can use namespaces explicitly through direct addressing or implicitly through the Imports statement. ©NIIT Introduction to VB.NET Lesson 2A / Slide 13 of 27
  • 14. Implementing Object Oriented Programming In Visual Basic.NET Abstract Classes in Visual Basic .NET • Visual Basic .NET enables you to create abstract classes that contain the skeleton of the methods implemented by the derived class. ©NIIT Introduction to VB.NET Lesson 2A / Slide 14 of 27
  • 15. Implementing Object Oriented Programming In Visual Basic.NET Understanding Structures • A structure is used to create user-defined data types. • You can declare a structure when you want a single variable to hold multiple types of related data. • Data can be stored in and retrieved from a structure. ©NIIT Introduction to VB.NET Lesson 2A / Slide 15 of 27
  • 16. Implementing Object Oriented Programming In Visual Basic.NET Interfaces in Visual Basic.NET • Interfaces are inheritable in Visual Basic.Net. • An interface defines properties, methods, and events. • You declare an interface using the Interface and End Interface statements. • You can declare only methods, functions, properties, and events in an interface. ©NIIT Introduction to VB.NET Lesson 2A / Slide 16 of 27
  • 17. Implementing Object Oriented Programming In Visual Basic.NET Interfaces in Visual Basic.NET(Contd.) • An interface can inherit members from an existing interface • The members of an interface consist of the declared members and the members inherited from its base interfaces. ©NIIT Introduction to VB.NET Lesson 2A / Slide 17 of 27
  • 18. Implementing Object Oriented Programming In Visual Basic.NET Inheritance • The inheritance feature allows you to define a new class by extending an existing class. ©NIIT Introduction to VB.NET Lesson 2A / Slide 18 of 27
  • 19. Implementing Object Oriented Programming In Visual Basic.NET Polymorphism • The concept of using operators or functions in different ways depending on what they are operating on is called polymorphism. ©NIIT Introduction to VB.NET Lesson 2A / Slide 19 of 27
  • 20. Implementing Object Oriented Programming In Visual Basic.NET Demo for Creating a Class in Visual Basic.Net ©NIIT Introduction to VB.NET Lesson 2A / Slide 20 of 27
  • 21. Implementing Object Oriented Programming In Visual Basic.NET Problem Statement • A company called Protec Inc. needs to maintain customer information. The details of the customer need to be accepted through a graphical interface. The user interface can be either Windows Forms, Web Forms, or Console. The customer information also needs to be stored in relevant memory variables of a class. The information should also be retrieved and displayed to the user. The details of the customer will include CustomerID, First Name, Last Name, Address, Telephone number and E-mail Id. ©NIIT Introduction to VB.NET Lesson 2A / Slide 21 of 27
  • 22. Implementing Object Oriented Programming In Visual Basic.NET Solution • A user interface screen is used to accept data from the user and displaying data to the user. A class can be used to store and retrieve data from the database. Perform the following steps to create a class: • Create a user interface. • Adding a class to the project • Write the code to store and retrieve data from the class •  Save and run the application ©NIIT Introduction to VB.NET Lesson 2A / Slide 22 of 27
  • 23. Implementing Object Oriented Programming In Visual Basic.NET Demo for Implementing Inheritance ©NIIT Introduction to VB.NET Lesson 2A / Slide 23 of 27
  • 24. Implementing Object Oriented Programming In Visual Basic.NET Problem Statement • The company Protec Inc needs data entry forms to store information in the Customers, Orders, and Query Handling databases. The data entry forms should have a similar user interface with the Reset and Exit buttons. Incorporate the interface for the Order details form. ©NIIT Introduction to VB.NET Lesson 2A / Slide 24 of 27
  • 25. Implementing Object Oriented Programming In Visual Basic.NET Solution • To create the user interface form you need to perform the following steps: • Create the user interface screen • Add code for the controls • Create an inherited form based on the base form • Add an inherited form to the project • Add the additional user interface control • Display a similar user interface • Add code for the inherited controls • Save and Execute the application ©NIIT Introduction to VB.NET Lesson 2A / Slide 25 of 27
  • 26. Implementing Object Oriented Programming In Visual Basic.NET Summary In this lesson, you learned that: • Visual Basic .NET is an object-oriented programming language • Classes can be added to a Visual Basic .NET project • An object is an instance of a class • Advantages of Using Classes and Objects • Maintenance of code • Encapsulation • Reusabilty • Support for a single interface to implement multiple methods • Constructors are special methods that allow control over the initialization of objects. • Destructors are special methods that are used to release the instance of a class from memory. ©NIIT Introduction to VB.NET Lesson 2A / Slide 26 of 27
  • 27. Implementing Object Oriented Programming In Visual Basic.NET Summary (Contd.) • An important advantage of using a namespace is the prevention of a name collision • Abstract classes are used to define the skeleton of the methods that the derived class can implement. • A structure is used to create user-defined data types. • An interface enables you to separate the definition of objects from their implementation so that the objects can evolve without the risk of introducing incompatibility in existing applications. • The inheritance feature allows you to define a new class by extending an existing class • The concept of using operators or functions in different ways depending on what they are operating on is called polymorphism. • Interfaces and classes are inheritable in Visual Basic .NET ©NIIT Introduction to VB.NET Lesson 2A / Slide 27 of 27