Exforsys

H I D E

Home arrow Technical Training arrow VB.NET 2005

VB.NET Creating and Managing Components Part 2

Page 1 of 2
Author : Exforsys Inc.     Published on: 6th Jul 2005    |   Last Updated on: 24th Dec 2007

Creating and Managing Components Part 2

In Section 2 of Creating and Managing Components You will learn about Hosting a control inside Internet Explorer, HTMLAnchor Control, HTMLButton Control, HTMLGeneric Control, Creating Components by extending the Control class, Creating a custom control and Creating components by extending the Component class.

Hosting a control inside Internet Explorer

ASP .NET server controls are group of new controls provided by .NET. They are of different kinds. HTML Server controls, Web Server controls and Validation controls are the other types. These controls derive from System.Object -> System.Web.UI.Control -. HtmlControl.

.

.

.

.
.
.

Some of the controls are listed below:

Control Related HTML Tag

HtmlAnchor

Allows access to program against the < a > tag

HTMLButton Allows access to program against the< button > tag

HTMLForm

Allows access to program against the < form > tag
HTMLGeneric Allows access to HTML tags that are not represented by any HTML server control specifically

HTMLImage

Allows access to program against the < img > tag

These controls are hosted in the browser by using codes which are discussed below:

HTMLAnchor Control

This control allows access to program the HTML tag. An example is shown below:

Aspx file code:

Click here for Sample Code

Code behind page code:

Click here for Sample Code

You can now see the control hosted in the browser:

HTMLButton Control

HTMLButton Control allows the user program the HTMLtag. This is the tag used to place clickable buttons within HTML documents. This is achieved by the following code:

The code that is written in the aspx page:

Click here for Sample Code

The code that is written in the code behind page:

Click here for Sample Code

The page when viewed in a browser looks like the screenshot below:

HTMLGeneric Control

HTMLGeneric control allows the user program the HTML tags that are not represented by any of the specified controls. Some of the examples are < span >, < div >, < body > and so on. The following demo illustrates the use of HTMLGeneric Control to access the HTML tag.

The codes that are given in the aspx page are given below:

Click here for Sample Code

The codes that are given in the code behind page are given below:

Click here for Sample Code

The view of the page in the browser is shown below:

Creating Components by extending the Control class

Components can be created by extending a control class. This feature enables the application developer in numerous ways. He can create customized components for his application using the basic functionality of the component as his starting point.

To start with, a library of derived controls can be created out of predefined controls. These controls can then be customized by adding specific functionalities. The features of the base class can also be extended by adding few properties that are essential to the application being developed.

Ads

Creating a custom control

1. Create a new control library project in the visual studio.

2. Right-click on the solution explorer and add a new custom control.

You will see a screen like the one you see below:

Controls can be dragged and dropped for customization. For the purposes of study, let us drag and drop a label control. The codes for this control will be displayed in the code window. Now add the following code to the class:

Click here for Sample Code

Read Next: .NET Assemblies


 
This tutorial is part of a VB.NET 2005 tutorial series. Read it from the beginning and learn yourself.

VB.NET 2005

  1. VB.NET 2005 Free Training
  2. The .NET Framework Architecture Part 1
  3. The .NET Framework Architecture Part 2
  4. Application Class and Message Class
  5. Implementing Class Library Object
  6. Visual Studio.NET Namespaces
  7. .NET Assemblies
  8. Differences between VB.NET 1.0 and VB.NET 2.0
  9. Introducing VB.NET Windows Forms
  10. Visual Studio Windows Forms Designer
  11. Exploring the Forms Designer generated code
  12. Setting and Adding Properties to Windows Form
  13. Implementing Inheritance
  14. Event Handling In Visual Basic .NET
  15. Building Graphical Interface elements
  16. .NET Common Windows Forms Controls Part 1
  17. .NET Common Windows Forms Controls Part 2
  18. Common Controls and Handling Control Events
  19. DomainUpDown and NumericUpDown Controls
  20. Dialog Boxes in Visual Basic .NET
  21. Visual Studio Adding Controls to Windows Form
  22. VB.NET Validation Controls
  23. Working with Menu Controls
  24. VB.NET MDI Applications
  25. .NET Exceptions
  26. VB.NET Creating and Managing Components Part 1
  27. VB.NET Creating and Managing Components Part 2
  28. Simple Data Binding
  29. .NET Complex Data Binding
  30. .NET Data Form Wizard
  31. Data Manipulation with ADO.NET
  32. SQL Server Stored Procedures
  33. SQL Server Ad Hoc Queries
  34. Finding and Sorting Data in DataSets
  35. ADO.NET Object Model
  36. Working with DataSets
  37. Using XML Data
  38. Working with File System in .NET
  39. Creating Web Service
  40. Instantiating - Invoking Web Services, Creating Proxy Classes with WSDL
  41. Web Reference and Web Services
  42. Web Services - SOAP, WSDL, Disco and UDDI
  43. Web Application Testing in VB.NET 2005
  44. Web Application Tracing and Debugging
  45. Working with Legacy Code and COM Components
  46. ActiveX Controls and Legacy Code
  47. Windows Application Testing
  48. VB.NET Windows Application Testing
  49. Tracing VB.NET Windows Application
  50. Debugging Windows Applications In Visual Studio.NET 2005
  51. Deploying Windows Applications In Visual Studio.NET 2005
  52. Customizing Setup Project in Visual Studio.NET 2005
  53. Shared Assembly
  54. Microsoft .NET Creating Installation Components
  55. The Registry Editor in Visual Studio.NET 2005
  56. The File Types Editor
 

Comments