Use an
Interface[
^].
Walkthrough: Creating and Implementing Interfaces (Visual Basic)[
^]
Public Interface ISaveableForm
Sub SaveNow()
End Interface
...
Private Sub SaveToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripButton.Click
Dim form As ISaveableForm = TryCast(MDICurrentForm, ISaveableForm)
If form IsNot Nothing Then
form.SaveNow()
End If
End Sub
Implement the interface in any form that needs to be saved:
Public Partial Class frmActivityLogViewer
Implements ISaveableForm
Public Sub SaveNow() Implements ISaveableForm.SaveNow
...
End Sub
End Class