Dave Keenan
8/19/2004 2:47:00 PM
I'm a working on a Windows Forms application using
remoting and have hit a problem. I have three basic
components:
1) A Remote object, call it myServer which is a
MarshallByRef singleton. This raises an Event called
myRemoteEvent.
2) A Client business logic class, call it myClient. This
subscribes to the myRemoteEvent event on the remote
server. It also can raise an event of it's own, called
myClientEvent.
3) A client side Windows form, call it myForm. This
contains an instance of myClient and subscribes to it's
myClientEvent event.
What I'm looking for to happen is myServer to raise
myRemoteEvent, myClient should handle this event by
raising myClientEvent and myForm should handle the
myClientEvent.
I can get myServer to raise it's event and myClient to
handle it in it's event handler. However, when I then try
to raise myClientEvent I get a null reference exception
even though myForm is definitely subscribed to it.
However, if I skip the remoting stage and have myClient
raise myClientEvent directly then the event is raised and
myForm responds as it should.
I think it's probably a fairly basic scope issue, but I'm
at a loss to solve it. If anyone wants I can put together
a sample Visual Studio solution illustrating my problem.
Any and all help appreciated!
Thanks,
Dave