http://msdn.microsoft.com/en-us/library/b86b82w0.aspx
- Introduction to Objects in Visual Basic
- Provides an introduction to the terms and concepts used in object-oriented programming.
- Understanding Classes
- Provides an overview of classes and an example of how to define a class.
- Creating and Using Objects
- Shows how to create and use instances of classes.
- Collections in Visual Basic
- Provides an overview of collections.
- Events in Visual Basic
- Shows how to declare and use events.
- Delegates in Visual Basic
- Shows how to declare and use delegates.
- Interfaces in Visual Basic
- Describes what interfaces are and how you can use them in your applications.
- Inheritance in Visual Basic
- Describes how to define classes that serve as the basis for other classes.
- Shared Members in Visual Basic
- Describes members that can be used without instances.
- Early and Late Binding
- Describes binding, which is performed by the compiler when an object is assigned to an object variable, and the differences between early-bound and late-bound objects.
Public Interface ICommonFunctions
Sub saverecord()
End Interface
Public Class frmSaleInvoice
Inherits System.Windows.Forms.Form
Implements ICommonFunctions ‘<—– our Interface
…… Normal Form objects……
Public Sub saverecord() Implements ICommonFunctions.saverecord
End Sub
End Class
‘Similarly other forms
Public Class frmSomeOtherForm
Inherits System.Windows.Forms.Form
Implements ICommonFunctions ‘<—– our Interface
…… Normal Form objects……
Public Sub saverecord() Implements ICommonFunctions.saverecord
….. The Function Body ….
End Sub
End Class
‘Then in MDI on a button click
If Not me.ActiveMDIChild Is Nothing then
DirectCast(Me.ActiveMdiChild,ICommonFunctions).saverecord() ‘<— Call the function
End If
# remember you are using ActiveMDIChild and not ActiveForm so the child forms must have their MDIParent set to the MDI form