SlideShare a Scribd company logo
Creating Components
Objectives
In this lesson, you will learn to:
Create components for Windows Forms
Use COM components in Visual Basic .NET
Implement an Interface in Visual Basic .NET




    ©NIIT                        Creating Components/Lesson 13/Slide 1 of 19
Creating Components
Component
Is a reusable piece of code in a binary form that can be
plugged into components from other vendors, with relatively
  little effort.
Helps in reducing the development time.
Helps in reducing errors because you reuse a code that is
 already tested.




   ©NIIT                      Creating Components/Lesson 13/Slide 2 of 19
Creating Components
Just a Minute…
You need to write a program to validate user logins. This
program will be used across applications. What will you
develop the program as and why?




   ©NIIT                      Creating Components/Lesson 13/Slide 3 of 19
Creating Components
Component Architecture in .NET
Assembly
    Contains information about the files on which the
     component depends and the location of these files.
    Consists of a manifest and the portable executables
     (PE).
Global Assembly Cache
    Is a repository of assemblies.
    Must have a unique identification to resolve name
     conflicts. To avoid this conflict you can also give a
     shared name to an assembly.


   ©NIIT                      Creating Components/Lesson 13/Slide 4 of 19
Creating Components
Just a Minute…
Why does an assembly need a shared name?




   ©NIIT                  Creating Components/Lesson 13/Slide 5 of 19
Creating Components
Component Classes
Get created when they follow defined standards of
interaction provided by the IComponent interface.
Can be created by using the .NET Class Library project
template.
Can be used in another project by adding a reference to the
     components.




   ©NIIT                     Creating Components/Lesson 13/Slide 6 of 19
Creating Components
Just a Minute…
How will you use a component?




   ©NIIT                   Creating Components/Lesson 13/Slide 7 of 19
Creating Components
Life Cycle of a Component
Initialization phase
    Can be of two types:
           ®Type initialization
           ®Instance initialization
Cleanup phase
    Is implemented by using the Dispose() method.
Destroy phase
    Gets invoked when the garbage collector finds that
     there are no references to the component and therefore
     it calls the Finalize() method of the component.
   ©NIIT                          Creating Components/Lesson 13/Slide 8 of 19
Creating Components
Polymorphism
Is the ability of a class to implement functions with the same
 name to perform different actions depending on how they
 are called.
Is a feature supported by all object-oriented languages.
Can be implemented in three ways:
     By implementing an interface
     By using inheritance
     By using abstract classes




   ©NIIT                      Creating Components/Lesson 13/Slide 9 of 19
Creating Components
COM in .NET
.NET supports COM and ActiveX objects for backward
compatibility.
Interaction between COM and .NET is provided through a
 wrapper called Runtime‑Callable Wrapper (RCW).
A COM component can be called from .NET in the following
 ways:
    By converting the COM type library to a .NET assembly
     by using the tlbimp tool
    Using COM components directly by adding a reference




   ©NIIT                   Creating Components/Lesson 13/Slide 10 of 19
Creating Components
Problem Statement 13.D.1
Customers of Diaz Telecommunications who place their
orders online must submit their credit card number, name, and
the expiry date of the credit card. The credit card number
submitted has to be validated.




   ©NIIT                     Creating Components/Lesson 13/Slide 11 of 19
Creating Components
Task List
Identify the most suitable type of component.
Identify the properties and methods for the component.
Create a project of the appropriate type.
Add properties and functions to the component.
Build the component.
Create a user interface to display the result.
Verify the execution.




   ©NIIT                      Creating Components/Lesson 13/Slide 12 of 19
Creating Components
Task 1: Identify the most suitable type of component.
Result:
A customized component has to be created to verify the
credit card numbers supplied by the customers.




   ©NIIT                    Creating Components/Lesson 13/Slide 13 of 19
Creating Components
Task 2: Identify the properties and methods for the
component.
You can have the following types of constructors in your
component:
    Public Constructors — To enable developers to create
     instances of your component.
    Friend Constructors — To enable the usage of a
     component inside an assembly but not outside it.
    Private Constructors — To enable the usage only inside
     the component class.




   ©NIIT                     Creating Components/Lesson 13/Slide 14 of 19
Creating Components
Task 2: Identify the properties and methods for the
component. (Contd.)
Result:
The two properties required for the components are:
    CustomerName: A property for the name of the
     customer of type string.
    CardNumber: A property for the card number of type
     string.
The following methods are required:
    The default public constructor can be used for this
     component.
    LeftChar(): A method to return the leftmost character
     from a string.

   ©NIIT                     Creating Components/Lesson 13/Slide 15 of 19
Creating Components
Task 2: Identify the properties and methods for the
component. (Contd.)
Result:
RightChar(): A method to return the rightmost character
     from a string.
CharaceterToInt(): A method to return the numerical
     equivalent of a character.
Validate(): A method to validate the card number.




   ©NIIT                   Creating Components/Lesson 13/Slide 16 of 19
Creating Components
Task 3: Create a project of the appropriate type.
Task 4: Add properties and functions to the
component.
Task 5: Build the component.
Task 6: Create a user interface to display the result.
Task 7: Verify the execution.




   ©NIIT                  Creating Components/Lesson 13/Slide 17 of 19
Creating Components
Problem Statement 13.P.1
The Employee data in the call centers at Diaz
Telecommunications requires check for valid employee id,
age, and salary entries. The employee id should start with the
letter ‘E’ followed by three digits. The age should be from 21
years to 60 years. In addition, the salary should be in the
range of $3000 to $35000. Create a component that will check
the validity of employee id, age, and salary.




   ©NIIT                     Creating Components/Lesson 13/Slide 18 of 19
Creating Components
Summary
In this lesson, you learned that:
A component is a reusable piece of code in a binary form
      that can be plugged into components from other
vendors,     with relatively little effort.
An assembly contains information about the files on which
      the component depends and the location of these files.
An interface can be implemented in a class to implement
      polymorphism.
Component Object Module (COM) is a
language‑independent software architecture that defines a set
of standards for component interoperability.
COM components can be used in .NET by using the tlbimp
    tool or by adding a reference.
    ©NIIT                      Creating Components/Lesson 13/Slide 19 of 19

More Related Content

Similar to Vb net xp_13

VB.Net GUI Unit_01
VB.Net GUI Unit_01VB.Net GUI Unit_01
VB.Net GUI Unit_01
Prashanth Shivakumar
 
Component Object Model (COM, DCOM, COM+)
Component Object Model (COM, DCOM, COM+)Component Object Model (COM, DCOM, COM+)
Component Object Model (COM, DCOM, COM+)
Peter R. Egli
 
Vb net xp_03
Vb net xp_03Vb net xp_03
Vb net xp_03Niit Care
 
Oopp Lab Work
Oopp Lab WorkOopp Lab Work
Oopp Lab Work
Heather Dionne
 
Vb6.0 intro
Vb6.0 introVb6.0 intro
Vb6.0 intro
JOSEPHINEA6
 
Creating simple component
Creating simple componentCreating simple component
Creating simple component
priya Nithya
 
Pa 10 n1 louis decroo jr.
Pa 10 n1 louis decroo jr.Pa 10 n1 louis decroo jr.
Pa 10 n1 louis decroo jr.
ldecroo
 
Composite design pattern
Composite design patternComposite design pattern
Composite design pattern
MUHAMMAD FARHAN ASLAM
 
Angular 8
Angular 8 Angular 8
Angular 8
Sunil OS
 
IT 200 Network DiagramBelow is the wired network configurat.docx
IT 200 Network DiagramBelow is the wired network configurat.docxIT 200 Network DiagramBelow is the wired network configurat.docx
IT 200 Network DiagramBelow is the wired network configurat.docx
priestmanmable
 
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab 6.docx
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab 6.docxStudent Lab Activity A. Lab # CIS CIS170A-A1B. Lab 6.docx
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab 6.docx
emelyvalg9
 
Visual basic
Visual basicVisual basic
Visual basic
sanjay joshi
 
Chapter2.ppt
Chapter2.pptChapter2.ppt
Chapter2.ppt
LalRatan
 
Web-Dev Portfolio
Web-Dev PortfolioWeb-Dev Portfolio
Web-Dev Portfolio
nwbgh
 
Component interface
Component interfaceComponent interface
Component interfaceJAYAARC
 
PT1420 Repetition Structures in Visual Basic .docx
PT1420 Repetition Structures in Visual Basic             .docxPT1420 Repetition Structures in Visual Basic             .docx
PT1420 Repetition Structures in Visual Basic .docx
amrit47
 
Visual basic
Visual basicVisual basic
Visual basic
umesh patil
 
POS 408 Education Specialist / snaptutorial.com
POS 408 Education Specialist / snaptutorial.comPOS 408 Education Specialist / snaptutorial.com
POS 408 Education Specialist / snaptutorial.com
McdonaldRyan107
 
POS 408 Effective Communication - tutorialrank.com
POS 408  Effective Communication - tutorialrank.comPOS 408  Effective Communication - tutorialrank.com
POS 408 Effective Communication - tutorialrank.com
Bartholomew58
 
Vb net xp_02
Vb net xp_02Vb net xp_02
Vb net xp_02Niit Care
 

Similar to Vb net xp_13 (20)

VB.Net GUI Unit_01
VB.Net GUI Unit_01VB.Net GUI Unit_01
VB.Net GUI Unit_01
 
Component Object Model (COM, DCOM, COM+)
Component Object Model (COM, DCOM, COM+)Component Object Model (COM, DCOM, COM+)
Component Object Model (COM, DCOM, COM+)
 
Vb net xp_03
Vb net xp_03Vb net xp_03
Vb net xp_03
 
Oopp Lab Work
Oopp Lab WorkOopp Lab Work
Oopp Lab Work
 
Vb6.0 intro
Vb6.0 introVb6.0 intro
Vb6.0 intro
 
Creating simple component
Creating simple componentCreating simple component
Creating simple component
 
Pa 10 n1 louis decroo jr.
Pa 10 n1 louis decroo jr.Pa 10 n1 louis decroo jr.
Pa 10 n1 louis decroo jr.
 
Composite design pattern
Composite design patternComposite design pattern
Composite design pattern
 
Angular 8
Angular 8 Angular 8
Angular 8
 
IT 200 Network DiagramBelow is the wired network configurat.docx
IT 200 Network DiagramBelow is the wired network configurat.docxIT 200 Network DiagramBelow is the wired network configurat.docx
IT 200 Network DiagramBelow is the wired network configurat.docx
 
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab 6.docx
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab 6.docxStudent Lab Activity A. Lab # CIS CIS170A-A1B. Lab 6.docx
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab 6.docx
 
Visual basic
Visual basicVisual basic
Visual basic
 
Chapter2.ppt
Chapter2.pptChapter2.ppt
Chapter2.ppt
 
Web-Dev Portfolio
Web-Dev PortfolioWeb-Dev Portfolio
Web-Dev Portfolio
 
Component interface
Component interfaceComponent interface
Component interface
 
PT1420 Repetition Structures in Visual Basic .docx
PT1420 Repetition Structures in Visual Basic             .docxPT1420 Repetition Structures in Visual Basic             .docx
PT1420 Repetition Structures in Visual Basic .docx
 
Visual basic
Visual basicVisual basic
Visual basic
 
POS 408 Education Specialist / snaptutorial.com
POS 408 Education Specialist / snaptutorial.comPOS 408 Education Specialist / snaptutorial.com
POS 408 Education Specialist / snaptutorial.com
 
POS 408 Effective Communication - tutorialrank.com
POS 408  Effective Communication - tutorialrank.comPOS 408  Effective Communication - tutorialrank.com
POS 408 Effective Communication - tutorialrank.com
 
Vb net xp_02
Vb net xp_02Vb net xp_02
Vb net xp_02
 

More from Niit Care (20)

Ajs 1 b
Ajs 1 bAjs 1 b
Ajs 1 b
 
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 3 a
Ajs 3 aAjs 3 a
Ajs 3 a
 
Ajs 3 c
Ajs 3 cAjs 3 c
Ajs 3 c
 
Ajs 2 b
Ajs 2 bAjs 2 b
Ajs 2 b
 
Ajs 2 a
Ajs 2 aAjs 2 a
Ajs 2 a
 
Ajs 2 c
Ajs 2 cAjs 2 c
Ajs 2 c
 
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
 

Recently uploaded

Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 

Recently uploaded (20)

Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 

Vb net xp_13

  • 1. Creating Components Objectives In this lesson, you will learn to: Create components for Windows Forms Use COM components in Visual Basic .NET Implement an Interface in Visual Basic .NET ©NIIT Creating Components/Lesson 13/Slide 1 of 19
  • 2. Creating Components Component Is a reusable piece of code in a binary form that can be plugged into components from other vendors, with relatively little effort. Helps in reducing the development time. Helps in reducing errors because you reuse a code that is already tested. ©NIIT Creating Components/Lesson 13/Slide 2 of 19
  • 3. Creating Components Just a Minute… You need to write a program to validate user logins. This program will be used across applications. What will you develop the program as and why? ©NIIT Creating Components/Lesson 13/Slide 3 of 19
  • 4. Creating Components Component Architecture in .NET Assembly Contains information about the files on which the component depends and the location of these files. Consists of a manifest and the portable executables (PE). Global Assembly Cache Is a repository of assemblies. Must have a unique identification to resolve name conflicts. To avoid this conflict you can also give a shared name to an assembly. ©NIIT Creating Components/Lesson 13/Slide 4 of 19
  • 5. Creating Components Just a Minute… Why does an assembly need a shared name? ©NIIT Creating Components/Lesson 13/Slide 5 of 19
  • 6. Creating Components Component Classes Get created when they follow defined standards of interaction provided by the IComponent interface. Can be created by using the .NET Class Library project template. Can be used in another project by adding a reference to the components. ©NIIT Creating Components/Lesson 13/Slide 6 of 19
  • 7. Creating Components Just a Minute… How will you use a component? ©NIIT Creating Components/Lesson 13/Slide 7 of 19
  • 8. Creating Components Life Cycle of a Component Initialization phase Can be of two types: ®Type initialization ®Instance initialization Cleanup phase Is implemented by using the Dispose() method. Destroy phase Gets invoked when the garbage collector finds that there are no references to the component and therefore it calls the Finalize() method of the component. ©NIIT Creating Components/Lesson 13/Slide 8 of 19
  • 9. Creating Components Polymorphism Is the ability of a class to implement functions with the same name to perform different actions depending on how they are called. Is a feature supported by all object-oriented languages. Can be implemented in three ways: By implementing an interface By using inheritance By using abstract classes ©NIIT Creating Components/Lesson 13/Slide 9 of 19
  • 10. Creating Components COM in .NET .NET supports COM and ActiveX objects for backward compatibility. Interaction between COM and .NET is provided through a wrapper called Runtime‑Callable Wrapper (RCW). A COM component can be called from .NET in the following ways: By converting the COM type library to a .NET assembly by using the tlbimp tool Using COM components directly by adding a reference ©NIIT Creating Components/Lesson 13/Slide 10 of 19
  • 11. Creating Components Problem Statement 13.D.1 Customers of Diaz Telecommunications who place their orders online must submit their credit card number, name, and the expiry date of the credit card. The credit card number submitted has to be validated. ©NIIT Creating Components/Lesson 13/Slide 11 of 19
  • 12. Creating Components Task List Identify the most suitable type of component. Identify the properties and methods for the component. Create a project of the appropriate type. Add properties and functions to the component. Build the component. Create a user interface to display the result. Verify the execution. ©NIIT Creating Components/Lesson 13/Slide 12 of 19
  • 13. Creating Components Task 1: Identify the most suitable type of component. Result: A customized component has to be created to verify the credit card numbers supplied by the customers. ©NIIT Creating Components/Lesson 13/Slide 13 of 19
  • 14. Creating Components Task 2: Identify the properties and methods for the component. You can have the following types of constructors in your component: Public Constructors — To enable developers to create instances of your component. Friend Constructors — To enable the usage of a component inside an assembly but not outside it. Private Constructors — To enable the usage only inside the component class. ©NIIT Creating Components/Lesson 13/Slide 14 of 19
  • 15. Creating Components Task 2: Identify the properties and methods for the component. (Contd.) Result: The two properties required for the components are:  CustomerName: A property for the name of the customer of type string.  CardNumber: A property for the card number of type string. The following methods are required:  The default public constructor can be used for this component.  LeftChar(): A method to return the leftmost character from a string. ©NIIT Creating Components/Lesson 13/Slide 15 of 19
  • 16. Creating Components Task 2: Identify the properties and methods for the component. (Contd.) Result: RightChar(): A method to return the rightmost character from a string. CharaceterToInt(): A method to return the numerical equivalent of a character. Validate(): A method to validate the card number. ©NIIT Creating Components/Lesson 13/Slide 16 of 19
  • 17. Creating Components Task 3: Create a project of the appropriate type. Task 4: Add properties and functions to the component. Task 5: Build the component. Task 6: Create a user interface to display the result. Task 7: Verify the execution. ©NIIT Creating Components/Lesson 13/Slide 17 of 19
  • 18. Creating Components Problem Statement 13.P.1 The Employee data in the call centers at Diaz Telecommunications requires check for valid employee id, age, and salary entries. The employee id should start with the letter ‘E’ followed by three digits. The age should be from 21 years to 60 years. In addition, the salary should be in the range of $3000 to $35000. Create a component that will check the validity of employee id, age, and salary. ©NIIT Creating Components/Lesson 13/Slide 18 of 19
  • 19. Creating Components Summary In this lesson, you learned that: A component is a reusable piece of code in a binary form that can be plugged into components from other vendors, with relatively little effort. An assembly contains information about the files on which the component depends and the location of these files. An interface can be implemented in a class to implement polymorphism. Component Object Module (COM) is a language‑independent software architecture that defines a set of standards for component interoperability. COM components can be used in .NET by using the tlbimp tool or by adding a reference. ©NIIT Creating Components/Lesson 13/Slide 19 of 19