Solved

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

Posted on 2004-08-04
4
457 Views
Last Modified: 2008-03-04
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!!
0
Comment
Question by:knobloch
  • 2
  • 2
4 Comments
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11719073
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
 

Author Comment

by:knobloch
ID: 11721770
Could you write a sample code for me?
How can I access for example "image1.gif" from ../mySubfolder/myFile.dll ?

Thanks
0
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 400 total points
ID: 11721795
Assemblt foo = Assembly.LoadFrom(path);
Stream stream = foo.GetManifestResourceStream("namespace.objectname");
Image i = Image.FromStream(stream);
0
 

Author Comment

by:knobloch
ID: 11721845
Thanks
That’s good enough for me.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now