Solved

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

Posted on 2004-08-04
4
458 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Run time Error 4 47
Connection String 16 54
Web Form VB.Net  import CSV 4 36
Following an example - Why do I need to click Save button twice? 3 25
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

786 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