PC Review


Reply
Thread Tools Rate Thread

catch event in non-visual class?

 
 
Craig Buchanan
Guest
Posts: n/a
 
      23rd Feb 2004
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


 
Reply With Quote
 
 
 
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      23rd Feb 2004
* "Craig Buchanan" <(E-Mail Removed)> scripsit:
> 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 K. Wagner [MVP]
<http://www.mvps.org/dotnet>
 
Reply With Quote
 
Malek
Guest
Posts: n/a
 
      23rd Feb 2004
use "addHandler" to link the event to the handler

"Craig Buchanan" <(E-Mail Removed)> wrote in message
news:eBWY$7i%(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Craig Buchanan
Guest
Posts: n/a
 
      23rd Feb 2004
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

"Herfried K. Wagner [MVP]" <hirf-spam-me-(E-Mail Removed)> wrote in message
news:c1dc8o$1hfuc4$(E-Mail Removed)...
> * "Craig Buchanan" <(E-Mail Removed)> scripsit:
> > 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 K. Wagner [MVP]
> <http://www.mvps.org/dotnet>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      23rd Feb 2004
* "Craig Buchanan" <(E-Mail Removed)> scripsit:
> 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.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: invoking an event in one class (for which the event hanlder isin another class) Rick Lones Microsoft C# .NET 0 3rd Sep 2010 12:35 PM
Try Catch Block for a Whole Class =?Utf-8?B?U29sdXRpb24gU2Vla2Vy?= Microsoft VB .NET 1 16th May 2005 05:48 PM
How to raise event in a List Item class and cause an event in the custom List class moondaddy Microsoft VB .NET 3 5th Apr 2005 07:27 PM
create custom exception class then catch it =?Utf-8?B?andkZHM=?= Microsoft C# .NET 1 24th Jan 2005 05:45 AM
catch event in non-visual class? Craig Buchanan Microsoft ASP .NET 1 23rd Feb 2004 05:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:00 PM.