Click here to Skip to main content
15,036,363 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good afternoon.

I have a problem I did not expect in an application windows forms. I'm creating a project in 3 layers, in which I need to send the ImageList control of my presentation layer to the business layer and then to access the data, but the problem is that the latter two layers are of type Class Library. But I can't create mthods like these in the business and data access layers:

C#
public class Business
{
     public void ReadFiles(Imagelist img)
     {
     }
}


Because the imagelist is not a valid type within a class library project. Anyone have any suggestions?
Thank you.
Posted
Comments
[no name] 15-Oct-12 16:40pm
   
Okay... so why don't you add the proper namespace to the libraries so that an ImageList is a valid type?
Sergey Alexandrovich Kryukov 15-Oct-12 18:16pm
   
How's your guitar? I mean, it's really a bad idea to do what OP wants -- it simply means "no layers".
--SA
[no name] 16-Oct-12 8:25am
   
It's nice. Got a BC Rich Mockingbird ST.
Sergey Alexandrovich Kryukov 16-Oct-12 12:37pm
   
Never knew what is that -- I play the classic (spanish) 6-string. Sounds impressive though...
--SA
Sergey Alexandrovich Kryukov 15-Oct-12 18:15pm
   
Why?!
--SA

1 solution

If you absolutely have to access the ImageList class in a class library, that library just needs to have a reference to System.Windows.Forms added.
The bigger issue I would have is this. There is likely an architectural issue at hand if you feel you require it. You should simply be sending a List of images or something like that around rather than an ImageList control.
   
v2
Comments
Sergey Alexandrovich Kryukov 15-Oct-12 18:15pm
   
It's a huge architectural issue already. If this is done between layers, is really means there are no reasonable layers. The UI should be isolated, and no other layers should have any UI concerns, ever.
--SA

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