473,396 Members | 2,011 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,396 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 21 '05 #1
5 1293
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 21 '05 #2
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 21 '05 #3
Hi Tom,

I was thinking often, were is that Tom Leylan gone,
(For me there are 2 Toms you and Tom Shelton)
And here he is again,

Welcome back.

Cor
Nov 21 '05 #4
Hi Tom,

I was thinking often, were is that Tom Leylan gone,
(For me there are 2 Toms you and Tom Shelton)
And here he is again,

Welcome back.

Cor
Nov 21 '05 #5
Hi Cor:

There are a like gazillion messages on this newsgroup these days and I
really can't spend all day reading through them. I can't believe I got
caught on an "off-by-one" error :-) Things are going well though, hope
they are for you too. I'm going to try and scan through the messages more
often.

Tom

"Cor Ligthert" <no************@planet.nl> wrote...
Hi Tom,

I was thinking often, were is that Tom Leylan gone,
(For me there are 2 Toms you and Tom Shelton)
And here he is again,

Welcome back.

Cor

Nov 21 '05 #6

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...
0
by: Mike Meyer | last post by:
The recent thread on threads caused me to reread the formal definition of SCOOP, and I noticed something I hadn't really impressed me the first time around: it's using staticly checkable rules to...
1
by: Fei Li | last post by:
I do not know if event handlers are called by the sequence of the subsription sequence.
1
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...
10
by: Franky | last post by:
How Remove All Handler on a event? Like remove all handler on the myButton.Click. Thanks ______________________________ Franky FrankyPDA_NOSPAM_@hotmail.com
2
by: nford | last post by:
Is there a way to check if an object handles a certain type of event or if the object is hooked up to a certain event handler/call back function? For instance what would be the equivalent syntax...
1
by: Larry Lard | last post by:
I know that when I define my own class with an event, eg Public Class Foo Public Event Bar .... behind the scenes VB creates a hidden (from IntelliSense) delegate class BarEventHandler and...
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...
66
by: Johan Tibell | last post by:
I've written a piece of code that uses sockets a lot (I know that sockets aren't portable C, this is not a question about sockets per se). Much of my code ended up looking like this: if...
5
by: zacks | last post by:
We have an application in use at several dozen of our customers. At one customer site, it behaves strangely. The same application runs three times with three different config files passed to it on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.