How do I inherit an existing control (user control) and add it to the ToolBox?
Locked
-
Friday, April 10, 2009 3:29 AM
How do I inherit an existing control (user control) and add it to the ToolBox?
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
All Replies
-
Friday, April 10, 2009 3:30 AM
Here is the walkthrough:
Step 1: Create your own controls by inheriting existing Windows Forms Controls (e.g. Button, TextBox, Label, etc.)
File menu -> New -> Project -> Windows Forms Control Library
In the code editor, change the base class to the control from which you want to inherit.
Public Class UserControl1 Inherits System.Windows.Forms.Button End Class
You can implement any custom methods or properties that your control will incorporate.
Build the project and generate a dll.
Detailed walkthrough: How to inherit from Existing Windows Forms Controls?
http://msdn2.microsoft.com/en-us/library/7h62478z.aspx
Step 2: Add the inherited control to the Toolbox
Right-click Toolbox -> Choose Item -> .NET Framework Components ->Clicking the Browser button to locate that dll and add it
Step 3: The control will now appear on the Toolbox and you can drag and drop it onto form designer view.
Tutorials:How to: Inherit from the Control Class
How to: Inherit from the UserControl Class
How to: Inherit from Existing Windows Forms Controls
For more FAQ about Visual Basic .NET General, please see Visual Basic .NET General FAQ
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked As Answer by Xiaoyun Li – MSFT Friday, April 10, 2009 3:46 AM
- Edited by Xiaoyun Li – MSFT Friday, April 10, 2009 7:08 AM
-
Friday, April 10, 2009 3:59 AMwhat is point of asking question and answer it, if know the answer dont bother to post it as question, do it as discussion. You want a shortcut to get points. This is learning center, stop copy and paste code here
kaymaf
I hope this helps, if that is what you want, just mark it as answer so that we can move on

