|
-
Oct 1st, 2003, 01:29 PM
#1
Thread Starter
Fanatic Member
Communication between dll's?
I have a main form in 1 dll and I have other subforms in anther dll. Is there any way for one of the sub forms to tell the main form that something happened, so that it can take action?
I tried using an object that had an event that is handled in the main form, and pass that object to the sub forms in the dll, but the object has to exist in both places, and doesn't seem to work anyway.
Any ideas? Is this clear?
-
Oct 1st, 2003, 01:58 PM
#2
I think the two choices are having a common object that they use or using remoting. Passing the common object seems like it would be the easiest. What was the trouble when you tried this?
-
Oct 1st, 2003, 02:57 PM
#3
Thread Starter
Fanatic Member
I didn't want to pass a common object because that would break encapsulation. The SubForms dll can potentially be used in other projects.
-
Oct 1st, 2003, 03:20 PM
#4
Can't DLL2 reference the SubForms DLL and gain access to events that way.
Or better yet you can just pass a delegate for your events. So in DLL2 whatever needs to receive events can receive a delegate instead that way the delegate can hold the sub to call no matter where its at. Will that work?
Last edited by Edneeis; Oct 1st, 2003 at 03:24 PM.
-
Oct 1st, 2003, 03:30 PM
#5
Thread Starter
Fanatic Member
I think I will use events - fired from the dll and handled by the main exe (main form). I figured out that I can create a class with an event in the subforms dll and create an instance of that object in the main exe. Then, I can fire events in the dll and have them handled in the exe.
I think that will work - but you never know until you code....
Thanks for your input and I'll let you know how I make out :-)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|