Calling a method from a Lib to Exe
-
Is it possible to call a method from a library to the main program and if so how (see example). If it is not possible please let me know. class Library1 { // Cannot add reference to Exe MethodA() } class Exe { // Reference to Library1 void MethodA() { a = b + c; } } There is a reference to Library1 in Exe I can not add a reference to Libray1 for Exe because I would get a circular reference therefore it can not see Exe. How can I solve this problem. Thanks in advance, Michael
-
Is it possible to call a method from a library to the main program and if so how (see example). If it is not possible please let me know. class Library1 { // Cannot add reference to Exe MethodA() } class Exe { // Reference to Library1 void MethodA() { a = b + c; } } There is a reference to Library1 in Exe I can not add a reference to Libray1 for Exe because I would get a circular reference therefore it can not see Exe. How can I solve this problem. Thanks in advance, Michael
You would have to delcare a delagate in the Library code - inform the Library of the Exe method which implements that delegate - i.e. have a method in the library which takes an instance of the Library delegate and then call that delegate from the library at the appropriate time....