TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
steven williamson
NA
1
0
Registering events dynamically with a remote object
Feb 20 2006 6:06 PM
Ok where do i begin... well i am trying to come up with a solution to allow me to register event handlers with an event dynamically. Consider the following code if (aEvent.Name.CompareTo("getFilesCalledEvent") == 0) { Delegate myDel =Delegate.CreateDelegate(aEvent.EventHandlerType, this, "EventCalled"); aEvent.AddEventHandler(this, myDel); } As far as im concerned this should register the method EventCalled contained in the running instance of the object pointed to by (this). When executed i get the exception "Object does not match target type", when i call the AddEventHandler Method. As far as i can assume this is because im using remoting, see aEvent is actually an EventInfo type returned from a remote object. So im guessing the delegate im passing in is actually trying to point to a local instance. But im registering it with a remote object, so when it tries to call back to the class that holds EventCalled it does not know to go through the remoting framework? Ie The object is pointing to does not exist in the context of the remote object. This is my best guess anyone who can help your a godsend! Steve.
Reply
Answers (
0
)
Call from a mobile phone
How use Paging DataGird in WinForm