Exforsys.com
 
Home Tutorials VB.NET 2005
 

VB.NET Creating and Managing Components Part 1

 

VB.NET Creating and Managing Components Part 1 - Page 3

Page 3 of 3


.


.


.



Inheriting from a UserControl

1. In Visual Studio create a new Control Class project.



2. Add to the class labels and textboxes as shown in the screenshot below.



3. You can also change the background color and any other display component property.



Let us assume that this control has been created to extend support for data entry across an organization. The control is then distributed to regions having their own servers and data structure. This control is created to provide support for data-entry to an organization. It is then distributed with each region having its own server and data structure. To provide a consistent look and feel over the organization this UserControl is devised. The SQL statement, connect string and organization name are some of the properties that can be set by external code. The following lines of code are added to the class.


Click here for Sample Code


In a new windows control project add new inherited control by right-clicking the project in the solution explorer. This will open up the “Add New Item” dialog box as shown below. In this dialog box choose the option inherited user control:



This will open the inheritance picker. Click on the browse button and navigate to the bin directory of the original UserControl that you had created earlier.. Choose the dll file and click OK. The screen shot is given below:



 


 


 


 


 


 


 


 


 


 



A new class is created and the code view of this class shows Visual Studio generated code. You can add your own code to these existing codes. The sample lines of code are given below:


Click here for Sample Code


You click on the Build menu and build the solution. This control can be added to the ToolBox and you can use this in any windows forms application.



The screen shot of the data – entry screen with incorrect value for Principle after the error message is dismissed




Error Message



The screen shot of the data – entry screen with incorrect value for Interest Rate after the error message is dismissed





First Page: VB.NET Creating and Managing Components Part 1


Read Next: VB.NET Creating and Managing Components Part 2



 

 

Comments


abhineet komal said:

  This is nice , but plz do mention how to write the assembliles files, and call it with an example
December 30, 2008, 6:04 am

Sunil Yadav said:

  very nice but explain with more example
January 22, 2009, 3:48 am

Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links

 

Subscribe via RSS


Get Daily Updates via Subscribe to Exforsys Free Training via email


Get Latest Free Training Updates delivered directly to your Inbox...

Enter your email address:


 

Subscribe to Exforsys Free Training via RSS
 

 
Partners -  Privacy and Legal Policy -  Site News -  Contact   Sitemap  

Copyright © 2000 - 2009 exforsys.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape