Difference between revisions of "Interface"
Jump to navigation
Jump to search
(Created page with "== Interface == This is a sample implementation of an Interface event caught in a form. === IEvents === <syntaxhighlight lang="vb"> Public Sub Event1() End Sub Public Function ...") |
|||
Line 1: | Line 1: | ||
== Interface == | == Interface == | ||
− | |||
=== IEvents === | === IEvents === |
Revision as of 02:27, 31 January 2012
Interface
IEvents
Public Sub Event1()
End Sub
Public Function Event2(ByVal intParameter As Integer) As Integer
End Sub
IObject
Public Property Get Value() As String
End Property
Public Sub execute()
End Sub
Public Sub setEventHandler(objEventHandler As IEvents)
End Sub
clsObject
Option Explicit
Implements IObject
Dim mIEvents As IEvents
Public Property Get Value() As String
'Raise Event1
mIEvents.Event1
End Property
Public Sub execute()
'Raise Event2
mIEvents.Event2(42)
End Sub
Public Sub setEventHandler(objIEvents As IEvents)
Set mIEvents = objIEvents
End Sub
Form
Option Explicit
Implements IEvents
Dim objObject As clsObject
'IEvents implementation
Public Sub IEvents_Event1()
'Event1 code
End Sub
Public Function IEvents_Event2(ByVal intParameter As Integer) As Integer
'Event2 code
End Sub
'Form
Private Sub Form_Load()
Set objObject = New clsObject
objObject.setEventHandler Me
End Sub