Hello,
Kwok said:
I have two objects, obj A for user input value, obj B for
get value from dataset.
I use obj B create obj A, how do I get parameters from obj
B when I add Handler and raiseEvent in obj A.
Written from scratch, untested:
\\\
Public Class Foo
Public Event Bla( _
ByVal sender As Object, _
ByVal e As BlaEventArgs _
)
Public Sub RaiseTheEvent()
Dim e As New BlaEventArgs()
RaiseEvent Bla(Me, e)
MsgBox(e.Accept.ToString())
End Sub
End Class
Public Class BlaEventArgs
Inherits EventArgs
Private m_Accept As Boolean
Public Sub New()
m_Accept = True
End Sub
Public Property Accept() As Boolean
Get
Return m_Accept
End Get
Set(ByVal Value As Boolean)
m_Accept = Value
End Set
End Property
End Class
///
Usage:
\\\
Private WithEvents m_MyFoo As Foo
..
..
..
m_MyFoo = New Foo()
..
..
..
Public Sub m_MyFoo_Bla( _
ByVal sender As Object, _
ByVal e As BlaEventArgs _
) Handles m_MyFoo.Bla
If ... Then
e.Accept = False
End If
End Sub
///