How to call windows app classes(exe) from DLL???

  • Thread starter Abdalla Fawaz El-Hawary
  • Start date
A

Abdalla Fawaz El-Hawary

I have a solution includes 2 projects the 1st one is a class library project
and the 2nd is windows application.
Normally i can use the classes wich in the 1st project(DLL) after add
refrence for this project at the windows application(2nd project) but the
problem is i can't do the versa (how can i call any classes located in the
windows application project from the DLL(1st project)...
for example i need to call bank_win.Form1 class which is located at the
windows application from the class library DLL project.
 
J

Joakim Karlsson

You can declare an interface in your class library, which is implemented
by your form or another class in the Windows Forms application. Let the
classes in your class library call instances of that interface.

This is good because it gives you a chance to design your class library
so that you aren't dependent on what kind of application is using it.
This enables you to reuse it in more than one scenario.

Another way could be to declare delegates in the class library, and call
the Windows Forms application's methods via those.

Regards,
Joakim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top