> I have a class that has a generic method that looks something like this:
>
[quoted text clipped - 10 lines]
> understanding how to store a reference to the callback routine at the class
> level so that I can use it in the event handler.
I don't "do" VB generic declarations, so I can't tell for sure if this
is actually a generic method or just a method within a generic class.
If it's a generic method, you'll have difficulties - you could store
just a Delegate reference and use DynamicInvoke, but it would be better
to make it strongly typed somehow - you may need to introduce an extra
generic type, or parameterize the existing type further.
It's hard to say without knowing more information, I'm afraid.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Barry Gilbert - 23 Oct 2007 19:49 GMT
Jon,
Thanks for your reply.
This is a generic method inside a User Control class. I considered making
the class generic, but I found that it's difficult (impossible?) to declare a
user control or form as generic. Am I right about this? I think this would
solve my problem.
Barry
> > I have a class that has a generic method that looks something like this:
> >
[quoted text clipped - 19 lines]
>
> It's hard to say without knowing more information, I'm afraid.
Jon Skeet [C# MVP] - 23 Oct 2007 20:56 GMT
> Thanks for your reply.
>
> This is a generic method inside a User Control class. I considered making
> the class generic, but I found that it's difficult (impossible?) to declare a
> user control or form as generic. Am I right about this? I think this would
> solve my problem.
I've made a user control generic in the past, but then I've had to
create a specific (non-generic) type derived from it in order to use
it, e.g.
public class WhizzyControl<T> : UserControl
{
... Lots of implementation
}
public class Int32WhizzyControl : WhizzyControl<int>
{
// No code whatsoever
}
That's worked fine for me, although I've only done it once. Would that
help you?

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Barry Gilbert - 23 Oct 2007 21:27 GMT
Jon,
I've been avoiding taking this on, but I suppose it's time to give it a go.
Thanks for your help.
> > Thanks for your reply.
> >
[quoted text clipped - 19 lines]
> That's worked fine for me, although I've only done it once. Would that
> help you?