SlideShare a Scribd company logo
1 of 27
Introducing User Controls And Managing
Components

Pre-Assessment Questions
    •    Consider the following statements:
         • Statement A: Timer is an in-built component.
         • Statement B: ServiceController is an in-built components.
         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              Creating and Managing components         Lesson 1B / Slide 1 of 27
Introducing User Controls And Managing
Components

Pre-Assessment Questions (Contd.)
    •    Consider the following statements:
         • Statement A. The wrapper that allows interaction between COM and
             .NET is called RCW.
         • Statement B. Implementation of component is called ActiveX.
         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             Creating and Managing components         Lesson 1B / Slide 2 of 27
Introducing User Controls And Managing
Components

Pre-Assessment Questions (Contd.)
    1.   The assemblies that are required during the execution of an assembly are
         called:
         •    Metadata
         •    Portable executable
         •    Manifest
         •    Dependencies

    3.   Using COM+, the business logic can be placed in:
         •    First tier
         •    Middle tier
         •    Third tier
         •    Any tier




 ©NIIT             Creating and Managing components         Lesson 1B / Slide 3 of 27
Introducing User Controls And Managing
Components

Pre-Assessment Questions (Contd.)
    •    Consider the following statements:
         • Statement A. Friend constructor can be used if you want to use a
             component inside an assembly but not outside it.
         • Statement B. Private constructor can be used in a component if you
             want to use it outside the component class.
         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             Creating and Managing components         Lesson 1B / Slide 4 of 27
Introducing User Controls And Managing
Components

Solutions to Pre-Assessment
Questions
         1.   b.
         2.   b.
         3.   d. Dependencies
         4.   d. Any tier
         5.   c.




 ©NIIT               Creating and Managing components   Lesson 1B / Slide 5 of 27
Introducing User Controls And Managing
Components

Objectives
    In this lesson, you will learn to:
         • Create customized user controls
         • Add existing components and controls to a user control
         • Declare and raise events in a user control
         • Create a user control
         • Identify the need for Web services
         • Identify the enabling technologies in Web services
         • Add and remove Web references




 ©NIIT             Creating and Managing components         Lesson 1B / Slide 6 of 27
Introducing User Controls And Managing
Components

Understanding User Controls
    •    In Visual Basic .NET, you use controls such as list boxes, text boxes, menus,
         check boxes, and buttons to add user interaction capability to the graphical
         applications.
    •    These controls are visual components that can be used across applications.




 ©NIIT                Creating and Managing components         Lesson 1B / Slide 7 of 27
Introducing User Controls And Managing
Components

User Controls
    •    You can create composite reusable controls and selectively expose the
         properties of these controls.
    •    The UserControl class can be used to combine the functionality of different
         controls into one unit that can be reused.
    •    The UserControl class can contain multiple child controls.
    •    The UserControl class presents a single and unified interface.




 ©NIIT                Creating and Managing components          Lesson 1B / Slide 8 of 27
Introducing User Controls And Managing
Components

Customized User Controls
    •    While creating a user control the class inherits from the UserControl class by
         default.
    •    To inherit the user control from another existing control, the Inherits
         System.Windows.Forms. UserControl statement needs to be changed to the
         class from which you want to inherit the control.




 ©NIIT                Creating and Managing components          Lesson 1B / Slide 9 of 27
Introducing User Controls And Managing
Components

Adding Properties And Functions
    •    To add functionalities to a control, code has to be added for the property by
         viewing the code for the control.
    •    The code will consist of the get and set methods of the property.




 ©NIIT                Creating and Managing components         Lesson 1B / Slide 10 of 27
Introducing User Controls And Managing
Components

Testing a Control
    •    A control is always used in a container.
    •    To test a control, you must host it in a Windows Form.




 ©NIIT                Creating and Managing components        Lesson 1B / Slide 11 of 27
Introducing User Controls And Managing
Components

Creating Custom Controls from the
Control Class
    •    To build a control from scratch, you can inherit from the Control class.
    •    The Control class defines input from the mouse and the keyboard.
    •    The Control class also defines the bounds and size of controls.




 ©NIIT                Creating and Managing components         Lesson 1B / Slide 12 of 27
Introducing User Controls And Managing
Components

Inheriting from a User Control
    •    User control can be used to build other controls.
    •    Parent methods of the base class can be overridden to provide extended
         functionality in the inherited control.




 ©NIIT               Creating and Managing components       Lesson 1B / Slide 13 of 27
Introducing User Controls And Managing
Components

Rendering Graphical Interface of
Custom Controls
    •    To provide a graphical interface to your custom controls you need to override
         the OnPaint() method of the control class.
    •    The OnPaint() method is executed when a control is first drawn and when a
         control is resized.




 ©NIIT                Creating and Managing components        Lesson 1B / Slide 14 of 27
Introducing User Controls And Managing
Components

Raising Events
    •    To use event handling, you should be able to:
           • Declare events.
           • Raise events.
           • handle the events raised by your control.




 ©NIIT               Creating and Managing components    Lesson 1B / Slide 15 of 27
Introducing User Controls And Managing
Components

Declaring Events
    •    You can declare events within:
           • Classes.
           • Structures.
           • Interfaces.
    •    To declare an event, you need to use the Event keyword.
    •    In Visual Basic .NET, you need to use the RaiseEvent keyword to raise an
         event.
    •    Any object capable of raising an event is an event sender.
    •    Event handlers are special types of procedures that are called when an event
         occurs.




 ©NIIT               Creating and Managing components        Lesson 1B / Slide 16 of 27
Introducing User Controls And Managing
Components

Delegates
    •    In Visual Basic .NET, you use delegates to call event procedures.
    •    Delegates are objects that you use to call the methods of other objects.
    •    Delegates in Visual Basic .NET can reference both shared and instance
         methods.




 ©NIIT                Creating and Managing components        Lesson 1B / Slide 17 of 27
Introducing User Controls And Managing
Components

Delegates and AddressOf Operator
    •    The AddressOf operator implicitly creates an instance of a delegate.
    •    Event handlers can be removed dynamically by using the RemoveHandler
         keyword.




 ©NIIT               Creating and Managing components     Lesson 1B / Slide 18 of 27
Introducing User Controls And Managing
Components




                   Demo
         Creating a User Control




 ©NIIT     Creating and Managing components   Lesson 1B / Slide 19 of 27
Introducing User Controls And Managing
Components

Problem Statement
    •    Build a user Control named ‘MyClock’ that will display the current time and
         will also perform the function of an alarm. Test this user control in a VB.NET
         application.




 ©NIIT              Creating and Managing components         Lesson 1B / Slide 20 of 27
Introducing User Controls And Managing
Components

Solution
  •      To build and use the ‘MyClock’ user control in an application, you need to
         perform the following steps:
         1.   Create the User Control.
         2.   Add Windows Controls to the User Controls.
         3.   Create the Inherited Control.
         4.   Add Properties to the User Control.
         5.   Test the User Control.




 ©NIIT                Creating and Managing components         Lesson 1B / Slide 21 of 27
Introducing User Controls And Managing
Components

Understanding Web Services
    •    The evolution of the Internet has resulted in a gradual shift from desktop to
         distributed applications.
    •    The development of distributed applications involves ensuring that components
         hosted in heterogeneous environments are interoperable.
    •    To address these issues, Web Services have been introduced.




 ©NIIT               Creating and Managing components        Lesson 1B / Slide 22 of 27
Introducing User Controls And Managing
Components

Introduction to Web Services
    •    A Web service exposes a number of methods that provide functionality that
         can be used by one or more applications, regardless of the programming
         languages, operating systems, and hardware platforms used to develop them.
    •    The methods that provide such functionality are called Web methods.
    •    An application that uses a Web service is called a Web service client.




 ©NIIT               Creating and Managing components      Lesson 1B / Slide 23 of 27
Introducing User Controls And Managing
Components

Enabling Technologies used in Web
Services
    •    Enabling technologies used in Web Services are:
           • XML
                • XML is a plain-text format that can be understood by any platform.
           • SOAP
                • SOAP is a standard communication protocol for interchanging
                  information in a structured format in a distributed environment.
           • WSDL
                • WSDL is a markup language that describes a Web service.
           • UDDI
                • UDDI provides a standard mechanism to register and discover a Web
                  service.




 ©NIIT               Creating and Managing components       Lesson 1B / Slide 24 of 27
Introducing User Controls And Managing
Components

Adding and Removing Web references
from a Project
    •    A Web Reference can be added and removed by using Solution Explorer.
    •    A Web Service can be called programmatically.




 ©NIIT               Creating and Managing components      Lesson 1B / Slide 25 of 27
Introducing User Controls And Managing
Components

Summary
    In this lesson, you learned that:


    •    User controls are visual components.
    •    You can create a reusable unit of controls and selectively expose their
         properties by inheriting from the UserControl class.
    •    You can create a customized user control by inheriting from an existing
         control.
    •    You can override the OnPaint() method to customize the drawing of a
         control.
    •    You can declare, raise, and handle events.
    •    Delegates are objects that you use to call the methods of other objects.




 ©NIIT              Creating and Managing components        Lesson 1B / Slide 26 of 27
Introducing User Controls And Managing
Components

Summary (Contd.)
    •    A Web service exposes functionality that can be used by one or more
         applications, regardless of the programming languages, operating systems,
         and hardware platforms used to develop them.
    •    The functionality exposed by a Web service can be accessed by applications
         by using Internet standards, such as HyperText Transfer Protocol (HTTP) and
         eXtensible Markup Language (XML).
    •    To be able to communicate with each other, a Web service and a client
         application must agree upon a common protocol. SOAP is a standard
         communications protocol for interchanging information in a structured format
         in a distributed environment.
    •    To be able to use a Web service, the developers of a client application need
         to know the methods exposed by the Web service and the parameters to be
         passed to these methods. Web Services Description Language (WSDL) is a
         markup language, which is used to describe a Web service.
    •    The Universal Description Discovery and Integration (UDDI) initiative is used
         to allow client applications to discover the Web services provided by various
         Web service providers.
 ©NIIT              Creating and Managing components        Lesson 1B / Slide 27 of 27

More Related Content

Similar to Vb.net session 10

Vb.net session 09
Vb.net session 09Vb.net session 09
Vb.net session 09Niit Care
 
Vb net xp_14
Vb net xp_14Vb net xp_14
Vb net xp_14Niit Care
 
Vb.net session 13
Vb.net session 13Vb.net session 13
Vb.net session 13Niit Care
 
Vb.net session 02
Vb.net session 02Vb.net session 02
Vb.net session 02Niit Care
 
Vb.net session 03
Vb.net session 03Vb.net session 03
Vb.net session 03Niit Care
 
Porting the Legacy Application to Composite Application Guidance
Porting the Legacy Application to Composite Application GuidancePorting the Legacy Application to Composite Application Guidance
Porting the Legacy Application to Composite Application GuidanceOur Community Exchange LLC
 
[iOS] Basic UI Elements
[iOS] Basic UI Elements[iOS] Basic UI Elements
[iOS] Basic UI ElementsNikmesoft Ltd
 
Engineering Software Products: 2. agile software engineering
Engineering Software Products: 2. agile software engineeringEngineering Software Products: 2. agile software engineering
Engineering Software Products: 2. agile software engineeringsoftware-engineering-book
 
Engineering Student MuleSoft Meetup#4 - API Testing With MuleSoft
Engineering Student MuleSoft Meetup#4 - API Testing With MuleSoftEngineering Student MuleSoft Meetup#4 - API Testing With MuleSoft
Engineering Student MuleSoft Meetup#4 - API Testing With MuleSoftJitendra Bafna
 
ICT104 Programming Assignment Compiled By Divya Lee.docx
ICT104 Programming Assignment  Compiled By Divya Lee.docxICT104 Programming Assignment  Compiled By Divya Lee.docx
ICT104 Programming Assignment Compiled By Divya Lee.docxtarifarmarie
 
Vb.net session 12
Vb.net session 12Vb.net session 12
Vb.net session 12Niit Care
 
Introduction to the web engineering Process.pdf
Introduction to the web engineering Process.pdfIntroduction to the web engineering Process.pdf
Introduction to the web engineering Process.pdfMahmoud268161
 
Tips and tricks of the 2021.4 release
Tips and tricks of the 2021.4 releaseTips and tricks of the 2021.4 release
Tips and tricks of the 2021.4 releaseCristina Vidu
 

Similar to Vb.net session 10 (20)

Vb.net session 09
Vb.net session 09Vb.net session 09
Vb.net session 09
 
Vb net xp_14
Vb net xp_14Vb net xp_14
Vb net xp_14
 
08 gui 11
08 gui 1108 gui 11
08 gui 11
 
Vb.net session 13
Vb.net session 13Vb.net session 13
Vb.net session 13
 
Vb.net session 02
Vb.net session 02Vb.net session 02
Vb.net session 02
 
Application slides
Application slidesApplication slides
Application slides
 
Learning%20%20 port
Learning%20%20 portLearning%20%20 port
Learning%20%20 port
 
Vb.net session 03
Vb.net session 03Vb.net session 03
Vb.net session 03
 
觀察者模式
觀察者模式 觀察者模式
觀察者模式
 
Porting the Legacy Application to Composite Application Guidance
Porting the Legacy Application to Composite Application GuidancePorting the Legacy Application to Composite Application Guidance
Porting the Legacy Application to Composite Application Guidance
 
Ajs 2 a
Ajs 2 aAjs 2 a
Ajs 2 a
 
[iOS] Basic UI Elements
[iOS] Basic UI Elements[iOS] Basic UI Elements
[iOS] Basic UI Elements
 
Engineering Software Products: 2. agile software engineering
Engineering Software Products: 2. agile software engineeringEngineering Software Products: 2. agile software engineering
Engineering Software Products: 2. agile software engineering
 
Engineering Student MuleSoft Meetup#4 - API Testing With MuleSoft
Engineering Student MuleSoft Meetup#4 - API Testing With MuleSoftEngineering Student MuleSoft Meetup#4 - API Testing With MuleSoft
Engineering Student MuleSoft Meetup#4 - API Testing With MuleSoft
 
ICT104 Programming Assignment Compiled By Divya Lee.docx
ICT104 Programming Assignment  Compiled By Divya Lee.docxICT104 Programming Assignment  Compiled By Divya Lee.docx
ICT104 Programming Assignment Compiled By Divya Lee.docx
 
Vb.net session 12
Vb.net session 12Vb.net session 12
Vb.net session 12
 
Introduction to the web engineering Process.pdf
Introduction to the web engineering Process.pdfIntroduction to the web engineering Process.pdf
Introduction to the web engineering Process.pdf
 
Se-Lecture-6.ppt
Se-Lecture-6.pptSe-Lecture-6.ppt
Se-Lecture-6.ppt
 
Tips and tricks of the 2021.4 release
Tips and tricks of the 2021.4 releaseTips and tricks of the 2021.4 release
Tips and tricks of the 2021.4 release
 
Ajs 2 b
Ajs 2 bAjs 2 b
Ajs 2 b
 

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 c
Ajs 4 cAjs 4 c
Ajs 4 c
 
Ajs 3 a
Ajs 3 aAjs 3 a
Ajs 3 a
 
Ajs 3 c
Ajs 3 cAjs 3 c
Ajs 3 c
 
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
 
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
 

Recently uploaded

Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 

Recently uploaded (20)

Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 

Vb.net session 10

  • 1. Introducing User Controls And Managing Components Pre-Assessment Questions • Consider the following statements: • Statement A: Timer is an in-built component. • Statement B: ServiceController is an in-built components. 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 Creating and Managing components Lesson 1B / Slide 1 of 27
  • 2. Introducing User Controls And Managing Components Pre-Assessment Questions (Contd.) • Consider the following statements: • Statement A. The wrapper that allows interaction between COM and .NET is called RCW. • Statement B. Implementation of component is called ActiveX. 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 Creating and Managing components Lesson 1B / Slide 2 of 27
  • 3. Introducing User Controls And Managing Components Pre-Assessment Questions (Contd.) 1. The assemblies that are required during the execution of an assembly are called: • Metadata • Portable executable • Manifest • Dependencies 3. Using COM+, the business logic can be placed in: • First tier • Middle tier • Third tier • Any tier ©NIIT Creating and Managing components Lesson 1B / Slide 3 of 27
  • 4. Introducing User Controls And Managing Components Pre-Assessment Questions (Contd.) • Consider the following statements: • Statement A. Friend constructor can be used if you want to use a component inside an assembly but not outside it. • Statement B. Private constructor can be used in a component if you want to use it outside the component class. 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 Creating and Managing components Lesson 1B / Slide 4 of 27
  • 5. Introducing User Controls And Managing Components Solutions to Pre-Assessment Questions 1. b. 2. b. 3. d. Dependencies 4. d. Any tier 5. c. ©NIIT Creating and Managing components Lesson 1B / Slide 5 of 27
  • 6. Introducing User Controls And Managing Components Objectives In this lesson, you will learn to: • Create customized user controls • Add existing components and controls to a user control • Declare and raise events in a user control • Create a user control • Identify the need for Web services • Identify the enabling technologies in Web services • Add and remove Web references ©NIIT Creating and Managing components Lesson 1B / Slide 6 of 27
  • 7. Introducing User Controls And Managing Components Understanding User Controls • In Visual Basic .NET, you use controls such as list boxes, text boxes, menus, check boxes, and buttons to add user interaction capability to the graphical applications. • These controls are visual components that can be used across applications. ©NIIT Creating and Managing components Lesson 1B / Slide 7 of 27
  • 8. Introducing User Controls And Managing Components User Controls • You can create composite reusable controls and selectively expose the properties of these controls. • The UserControl class can be used to combine the functionality of different controls into one unit that can be reused. • The UserControl class can contain multiple child controls. • The UserControl class presents a single and unified interface. ©NIIT Creating and Managing components Lesson 1B / Slide 8 of 27
  • 9. Introducing User Controls And Managing Components Customized User Controls • While creating a user control the class inherits from the UserControl class by default. • To inherit the user control from another existing control, the Inherits System.Windows.Forms. UserControl statement needs to be changed to the class from which you want to inherit the control. ©NIIT Creating and Managing components Lesson 1B / Slide 9 of 27
  • 10. Introducing User Controls And Managing Components Adding Properties And Functions • To add functionalities to a control, code has to be added for the property by viewing the code for the control. • The code will consist of the get and set methods of the property. ©NIIT Creating and Managing components Lesson 1B / Slide 10 of 27
  • 11. Introducing User Controls And Managing Components Testing a Control • A control is always used in a container. • To test a control, you must host it in a Windows Form. ©NIIT Creating and Managing components Lesson 1B / Slide 11 of 27
  • 12. Introducing User Controls And Managing Components Creating Custom Controls from the Control Class • To build a control from scratch, you can inherit from the Control class. • The Control class defines input from the mouse and the keyboard. • The Control class also defines the bounds and size of controls. ©NIIT Creating and Managing components Lesson 1B / Slide 12 of 27
  • 13. Introducing User Controls And Managing Components Inheriting from a User Control • User control can be used to build other controls. • Parent methods of the base class can be overridden to provide extended functionality in the inherited control. ©NIIT Creating and Managing components Lesson 1B / Slide 13 of 27
  • 14. Introducing User Controls And Managing Components Rendering Graphical Interface of Custom Controls • To provide a graphical interface to your custom controls you need to override the OnPaint() method of the control class. • The OnPaint() method is executed when a control is first drawn and when a control is resized. ©NIIT Creating and Managing components Lesson 1B / Slide 14 of 27
  • 15. Introducing User Controls And Managing Components Raising Events • To use event handling, you should be able to: • Declare events. • Raise events. • handle the events raised by your control. ©NIIT Creating and Managing components Lesson 1B / Slide 15 of 27
  • 16. Introducing User Controls And Managing Components Declaring Events • You can declare events within: • Classes. • Structures. • Interfaces. • To declare an event, you need to use the Event keyword. • In Visual Basic .NET, you need to use the RaiseEvent keyword to raise an event. • Any object capable of raising an event is an event sender. • Event handlers are special types of procedures that are called when an event occurs. ©NIIT Creating and Managing components Lesson 1B / Slide 16 of 27
  • 17. Introducing User Controls And Managing Components Delegates • In Visual Basic .NET, you use delegates to call event procedures. • Delegates are objects that you use to call the methods of other objects. • Delegates in Visual Basic .NET can reference both shared and instance methods. ©NIIT Creating and Managing components Lesson 1B / Slide 17 of 27
  • 18. Introducing User Controls And Managing Components Delegates and AddressOf Operator • The AddressOf operator implicitly creates an instance of a delegate. • Event handlers can be removed dynamically by using the RemoveHandler keyword. ©NIIT Creating and Managing components Lesson 1B / Slide 18 of 27
  • 19. Introducing User Controls And Managing Components Demo Creating a User Control ©NIIT Creating and Managing components Lesson 1B / Slide 19 of 27
  • 20. Introducing User Controls And Managing Components Problem Statement • Build a user Control named ‘MyClock’ that will display the current time and will also perform the function of an alarm. Test this user control in a VB.NET application. ©NIIT Creating and Managing components Lesson 1B / Slide 20 of 27
  • 21. Introducing User Controls And Managing Components Solution • To build and use the ‘MyClock’ user control in an application, you need to perform the following steps: 1. Create the User Control. 2. Add Windows Controls to the User Controls. 3. Create the Inherited Control. 4. Add Properties to the User Control. 5. Test the User Control. ©NIIT Creating and Managing components Lesson 1B / Slide 21 of 27
  • 22. Introducing User Controls And Managing Components Understanding Web Services • The evolution of the Internet has resulted in a gradual shift from desktop to distributed applications. • The development of distributed applications involves ensuring that components hosted in heterogeneous environments are interoperable. • To address these issues, Web Services have been introduced. ©NIIT Creating and Managing components Lesson 1B / Slide 22 of 27
  • 23. Introducing User Controls And Managing Components Introduction to Web Services • A Web service exposes a number of methods that provide functionality that can be used by one or more applications, regardless of the programming languages, operating systems, and hardware platforms used to develop them. • The methods that provide such functionality are called Web methods. • An application that uses a Web service is called a Web service client. ©NIIT Creating and Managing components Lesson 1B / Slide 23 of 27
  • 24. Introducing User Controls And Managing Components Enabling Technologies used in Web Services • Enabling technologies used in Web Services are: • XML • XML is a plain-text format that can be understood by any platform. • SOAP • SOAP is a standard communication protocol for interchanging information in a structured format in a distributed environment. • WSDL • WSDL is a markup language that describes a Web service. • UDDI • UDDI provides a standard mechanism to register and discover a Web service. ©NIIT Creating and Managing components Lesson 1B / Slide 24 of 27
  • 25. Introducing User Controls And Managing Components Adding and Removing Web references from a Project • A Web Reference can be added and removed by using Solution Explorer. • A Web Service can be called programmatically. ©NIIT Creating and Managing components Lesson 1B / Slide 25 of 27
  • 26. Introducing User Controls And Managing Components Summary In this lesson, you learned that: • User controls are visual components. • You can create a reusable unit of controls and selectively expose their properties by inheriting from the UserControl class. • You can create a customized user control by inheriting from an existing control. • You can override the OnPaint() method to customize the drawing of a control. • You can declare, raise, and handle events. • Delegates are objects that you use to call the methods of other objects. ©NIIT Creating and Managing components Lesson 1B / Slide 26 of 27
  • 27. Introducing User Controls And Managing Components Summary (Contd.) • A Web service exposes functionality that can be used by one or more applications, regardless of the programming languages, operating systems, and hardware platforms used to develop them. • The functionality exposed by a Web service can be accessed by applications by using Internet standards, such as HyperText Transfer Protocol (HTTP) and eXtensible Markup Language (XML). • To be able to communicate with each other, a Web service and a client application must agree upon a common protocol. SOAP is a standard communications protocol for interchanging information in a structured format in a distributed environment. • To be able to use a Web service, the developers of a client application need to know the methods exposed by the Web service and the parameters to be passed to these methods. Web Services Description Language (WSDL) is a markup language, which is used to describe a Web service. • The Universal Description Discovery and Integration (UDDI) initiative is used to allow client applications to discover the Web services provided by various Web service providers. ©NIIT Creating and Managing components Lesson 1B / Slide 27 of 27