How to load over 40 dll files into C# application.

Hi
I have a little problem with dll files.
My application requires over 40 dll, which contain images for Windows Forms, and I just wonder what is the best way to load these dll into application. Problem is that dll files are stored in different subfolders of main application; I want to call it dynamically when I need it.

Could anyone tell me how to do it and how to access images from dll files?
I will appreciate sample code!!
knoblochAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
gregoryyoungConnect With a Mentor Commented:
Assemblt foo = Assembly.LoadFrom(path);
Stream stream = foo.GetManifestResourceStream("namespace.objectname");
Image i = Image.FromStream(stream);
0
 
gregoryyoungCommented:
you would use the Assembly object to open the .dll the use  Assembly.GetManifestResourceStream("namespace." + strIdentifier)); to get the embedded resource

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemReflectionAssemblyClassGetManifestResourceStreamTopic2.asp

you would then use Image.FromStream() to load an image from the resource strem.
0
 
knoblochAuthor Commented:
Could you write a sample code for me?
How can I access for example "image1.gif" from ../mySubfolder/myFile.dll ?

Thanks
0
 
knoblochAuthor Commented:
Thanks
That’s good enough for me.

0
All Courses

From novice to tech pro — start learning today.