Writing a Custom Control for Visual Basic
First Phase is always looking for example code to allow untangling very poorly written explanations.
- Sample Active X Control at VisualBasicBooks
- Developing Windows Forms Controls at Design Time
- VB ActiveX control examples
- Planet Source Code
- vb-helper.com
- MSDN
- StartVBdotNet – step by step with mention of inheritance at the end
- Creating a Visual Basic Custom Control
Variable Visibility
You can pass variables / objects back and forth between a Visual Basic Form and a UserControl. This archive has source code showing you how to do this:
You can make properties for the following things: Forms, UserControls and Class Modules. Basically any element that will behave as an object.
Properties are handy when you want to generalize your code: if you're changing a setting of something, it might be better to create it as a property. Especially if you might have a need to get a return value as well. The property code can then do some additional stuff, such as switching form's menu items automatically to correct value, so you don't need to do it from whereever you set the property.
Property Passing
This accesses a property of the Custom Control
| Parent Form | Custom Control |
|
ParentForm.Caption=UserControl1.Caption |
Dim m_Caption As String
Public Property Get Caption() As String |
……..more
