473,320 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Checking a VB handler in a C# class's invocation list

I'm either passing the wrong thing, comparing the wrong thing or...
something else.

I have a CSharp base class which is used to fire events and in CSharp I have
defined a delegate for the custom eventhandler. I use this as a subclass
for classes created in VB.Net. I realize I can define it all in VB.Net but
I need it done this way. I can add an eventhandler in a VB.Net app to the
VB.Net object I've created and all the events are firing fine. I wanted to
add a couple of diagnostics to the CSharp base class.

I added a method named SubscriberCount which returns the size of the
InvocationList and that works fine. I can see it in my VB class and I can
make it visible to the app and that all works. Now I wanted to see if a
particular handler was in the InvocationList. I'm not trying to return the
list, I'm passing the AddressOf MyEventHandler but it never finds a match.

It is iterating through the list fine, I've traced everything I think I'm
comparing the wrong thing. Does anybody have a clue as to what I might be
doing wrong? I'm passing the addressof the handler in the VB.App to a
method in the VB.Class which passes it along to MyBase.IsSubscriber. I've
had that routine compare the object for each Delegate in the list (that
didn't seem to match) then I tried matching the .Target to each .Target
(didn't work) then I tried the object to the .Target and that didn't work.

I'm checking things in the watch window but I can't seem to see what it
wants. I noticed that VB doesn't actually care I can RemoveHandler even if
I haven't added it but now it's just become something I want to complete and
I'd rather not remove a handler that wasn't there in any case.

Thanks for any pointers, I've searched all over,
Tom
Nov 16 '05 #1
1 1410
As I feared it was the 3rd option "something else". The good news is it
works the bad news is I can't count :-(

"Tom Leylan" <ge*@iamtiredofspam.com> wrote in message
news:ub**************@TK2MSFTNGP09.phx.gbl...
I'm either passing the wrong thing, comparing the wrong thing or...
something else.

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Edward Diener | last post by:
I am surprised that a MulticastDelegate does not have a particular member function which checks if a particular delegate is in its invocation list. I can do this manually of course but a Find, or...
5
by: Tom Leylan | last post by:
I'm either passing the wrong thing, comparing the wrong thing or... something else. I have a CSharp base class which is used to fire events and in CSharp I have defined a delegate for the custom...
0
by: Tom Leylan | last post by:
I'm either passing the wrong thing, comparing the wrong thing or... something else. I have a CSharp base class which is used to fire events and in CSharp I have defined a delegate for the custom...
3
by: Beth | last post by:
in the following: this.ExitButton.Click += new System.EventHandler(this.ExitButton_Click); if I saw an equation, such as y +=x; then y = y+x. But what is the meaning in the event handler. I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.