Don't use AddHandler() and WithEvents together...
When using WithEvents you flag a sub to trap an Event using the Handles keyword:
(this can be done using the dropdown menus across the top of the IDE)
Public Class SomeClass
Public Event SomeEvent()
Public Event AnotherEvent(ByVal param1 As Integer)
End Class
Public Class Form1
Private WithEvents sc As SomeClass
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
sc = New SomeClass
End Sub
Private Sub sc_SomeEvent() Handles sc.SomeEvent
End Sub
Private Sub sc_AnotherEvent(ByVal param1 As Integer) Handles sc.AnotherEvent
End Sub
End Class
Main Topics
Browse All Topics





by: adam_pedleyPosted on 2006-06-12 at 20:11:30ID: 16891341
haha
well now that im a bit less lazy and tried it myself you need to instantiate it first.
So now, whats the proper way to solve this issue.
A redesign?