R
Rob R. Ainscough
During the course of separating my Business code from UI code, I'm trying to
have nested class instances be able to RaiseEvent on my Form1 code. I'm not
have much success, it works with the immediate class, but if that class
calls another class that needs to trigger the same event, that event never
gets triggered. Can this be done?
----------------------------------------------------------------
Form1
Private WithEvents mClass1 As New myClass
Private Sub OnProgressStep(ByVal aStep As Integer) Handles
mClass1.ProgressStep
Form1.ProgressBar.Step = aStep
End Sub
IF mClass.SomeMethod Then
msgBox "Success"
End IF
----------------------------------------------------------------
myClass
Public Event ProgressStep()
Public Function SomeMethod() As Boolean
Dim anotherClass as New myOtherClass
anotherClass.OtherMethod()
End Function
-----------------------------------------------------------------
myOtherClass
Public Event ProgressStep()
Public Sub OtherMethod()
RaiseEvent ProgressStep
End Sub
I was hoping RaiseEvent ProgressStep in OtherMethod would trigger the event,
but it doesn't -- how do I make nested object instances trigger the same UI
event as the calling object instance?
thanks, Rob.
have nested class instances be able to RaiseEvent on my Form1 code. I'm not
have much success, it works with the immediate class, but if that class
calls another class that needs to trigger the same event, that event never
gets triggered. Can this be done?
----------------------------------------------------------------
Form1
Private WithEvents mClass1 As New myClass
Private Sub OnProgressStep(ByVal aStep As Integer) Handles
mClass1.ProgressStep
Form1.ProgressBar.Step = aStep
End Sub
IF mClass.SomeMethod Then
msgBox "Success"
End IF
----------------------------------------------------------------
myClass
Public Event ProgressStep()
Public Function SomeMethod() As Boolean
Dim anotherClass as New myOtherClass
anotherClass.OtherMethod()
End Function
-----------------------------------------------------------------
myOtherClass
Public Event ProgressStep()
Public Sub OtherMethod()
RaiseEvent ProgressStep
End Sub
I was hoping RaiseEvent ProgressStep in OtherMethod would trigger the event,
but it doesn't -- how do I make nested object instances trigger the same UI
event as the calling object instance?
thanks, Rob.