Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all

In my Solution , I have Four project(three of project is Class Library that Create Dll)

I wanna access to main form(as following in loan project ), in the the class library(talent) , how do it ?

attention: loan project(is my project name) is not the class library.

Loan -> main project (have main-form)

class library :
talent
BAl
DAL



thanks a lot.
Posted
Updated 13-Apr-15 6:17am
v2

1 solution

Don't.

There are problems with even trying, such as circular references: since your Main form needs to reference your class library (in order to access your "talent" code) you can't add a reference to your Main project to your "talent" project without setting up a circular reference which would mean that your project could never compile (as any change to the Main project means the talent needs to be rebuilt, which causes the main to need rebuilding, which means that talent needs to be rebuilt, and so on.

And logically, it wrong as well - your DLL shouldn't need to know anything about the presentation layer at all! If it does, you can't replace a layer at a later date, which is a bad idea.

Instead, look at creating events in the library which the form handles to provide information to the library when it needs it.
 
Share this answer
 
Comments
BillWoodruff 13-Apr-15 13:46pm    
+5 Amen !

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900