Dear CyhperDrive,
You can take the following steps to inherit a form programmatically.
1. If the form you wish to inherit from is not in the same namespace as
your class, then in your class, add a reference to the namespace containing
the form you wish to inherit from. e.g.
Imports Namespace1
2. In the class definition, add a reference to the form to inherit from.
The reference should include the namespace that contains the form, followed
by a period, then the name of the base form itself. e.g.
Public Class Form2
Inherits Namespace1.Form1
....
End Class
However, if the form you wish to inherit from is in the same namespace as
your class, then you can omit the namespace, i.e. just put the name of the
base form after the Inherits keyword.
When inheriting forms, there's one important thing we should put attention
to: because each event can be handled by both the base form and the
inherited form, means each event handlers may be called twice.
To avoid this, you can refer to this document:
[ Troubleshooting Inherited Event Handlers in Visual Basic .NET ]
http://msdn.microsoft.com/en-us/library/e33683a5(VS.71).aspx
To learn more about the form inheritance, you can refer to these articles:
[ Everything you wanted to know about Forms Inheritance in VB.NET ]
http://www.codeproject.com/KB/dotnet/BestFormInheritance.aspx
[ Windows Forms Inheritance ]
http://msdn.microsoft.com/en-us/library/aa983613(VS.71).aspx
If you need more information about this, please don't hesitate to let me
know.
Sincerely,
Zhi-Xin Ye
Microsoft Managed Newsgroup Support Team
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
This posting is provided "AS IS" with no warranties, and confers no rights.