catch event in non-visual class?

  • Thread starter Thread starter Craig Buchanan
  • Start date Start date
C

Craig Buchanan

I am using a third-party .Net component that raises an event with arguments
as a result of a method call. Is it possible to catch this event in a
mid-tier vb class, rather than a webform's code-behind class?

Thanks

Craig Buchanan
 
* "Craig Buchanan said:
I am using a third-party .Net component that raises an event with arguments
as a result of a method call. Is it possible to catch this event in a
mid-tier vb class, rather than a webform's code-behind class?

Have a look at 'AddHandler' and 'RemoveHandler'.
 
Herfried-

Could you elaborate?

I have a method named Fetch that invokes this 3rd-party component. When
this generates an event, with event arguments, i want to go to a sub in the
class. So, far I have this:

Public Sub Fetch()

AddHandler _Nntp.OnHeader,Me.Article_Headers( what do i add here?)
_Nntp.FetchArticle
...
End Sub

Private Sub Article_Headers(Byval Sender as Object, e as
NntpHeaderEventArgs)
'actions here
End Sub

Thanks,

Craig
 
* "Craig Buchanan said:
I have a method named Fetch that invokes this 3rd-party component. When
this generates an event, with event arguments, i want to go to a sub in the
class. So, far I have this:

Public Sub Fetch()

AddHandler _Nntp.OnHeader,Me.Article_Headers( what do i add here?)

Nothing. You don't need to add any braces there.
 
Back
Top