473,406 Members | 2,208 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

GetManifestResourceStream stream question

I'm reading embedded bitmaps from an EXE project and everthing works fine. I
do a GetExecutingAssembly, followed by setting a stream object to
MyAssemblyName.GetManifestResourceStream("MyApp.My Bitmap.BMP"). Note that
the BMP is set as an embedded resource via it's properties in the VB.NET
project. Finally, I do a "New Bitmap(MyStream)" to fetch the resource into a
Bitmap object and job done - I can display it in a PictureBox.

However, when I add the same bmp into a DLL (ie: a Class Library project)
instead of an EXE project, it doesn't work. When I set the stream object to
MyAssemblyName.GetManifestResourceStream("MyDllNam e.MyBitmap.BMP") the
stream is returned as "nothing". I'm sure my embedded resource path is
correct because I use "ILDASM.EXE" to check out the DLL assemblies manifest,
and the path shows as public mydllname.MyBitmap.BMP.

So what am I doing wrong? Is it not permitted to read embedded resources
from a DLL? Or am I missing a step when dealing with DLL's? All I get is an
exception loading the bitmap because the stream is "nothing".

Thanks for help,

Tom Edelbrok
Nov 21 '05 #1
1 5271
Figured it out!

When you have an EXE project open simultaneous with a DLL (Class Library)
project VB.NET will permit you to flip back and forth between the two very
easily. You can even make changes in the DLL code while in the EXE project
and do debugging.

BUT DON'T!!!

Because the code changes you make don't always apply. To be certain that
they are applied you must always go back to the DLL project, rebuild it,
then go back to your EXE project and run.

Therefore the coding changes I made to fix my Embedded Resource problem
weren't being applied. In fact, my coding changes were correct but I didn't
know it.

Tom

"Tom Edelbrok" <an*******@anonymous.com> wrote in message
news:htebe.13$vN2.7@clgrps13...
I'm reading embedded bitmaps from an EXE project and everthing works fine.
I do a GetExecutingAssembly, followed by setting a stream object to
MyAssemblyName.GetManifestResourceStream("MyApp.My Bitmap.BMP"). Note that
the BMP is set as an embedded resource via it's properties in the VB.NET
project. Finally, I do a "New Bitmap(MyStream)" to fetch the resource into
a Bitmap object and job done - I can display it in a PictureBox.

However, when I add the same bmp into a DLL (ie: a Class Library project)
instead of an EXE project, it doesn't work. When I set the stream object
to MyAssemblyName.GetManifestResourceStream("MyDllNam e.MyBitmap.BMP") the
stream is returned as "nothing". I'm sure my embedded resource path is
correct because I use "ILDASM.EXE" to check out the DLL assemblies
manifest, and the path shows as public mydllname.MyBitmap.BMP.

So what am I doing wrong? Is it not permitted to read embedded resources
from a DLL? Or am I missing a step when dealing with DLL's? All I get is
an exception loading the bitmap because the stream is "nothing".

Thanks for help,

Tom Edelbrok

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Steve Guidi | last post by:
Hello, I'm developing an application that periodically reads embedded assembly resources. The resources are text-based, and are about 3-7KB in size, and the application accesses them by calling...
1
by: Mark Rae | last post by:
Hi, I'm writing a WinForms app in C# which requires a 3rd party executable called htmldoc.exe in order to create PDF documents from HTML files. To prevent the app from not functioning if the...
0
by: Darryn Ross | last post by:
Hi, I am trying to use GetManifestResourceStream and i keep getting a NULL exception error?? i cannot understand why? private Bitmap _buttonFace; .. ..
4
by: TT (Tom Tempelaere) | last post by:
Hey there, I need a string stream, but I can't find one in .NET. I thought StringWriter would derive from Stream, alas it doesn't do so. Which leads me to my next question: What is the purpose...
7
by: simonrigby_uk | last post by:
Hi all, Sorry if this is the incorrect group but I couldn't see anything directly relevant. Can someone confirm for me what happens when two network streams are sent to an application at the...
2
by: Jonathan Crawford | last post by:
Hi I downloaded a sample from here http://64.78.52.104/FAQ/WinForms/default.asp#44 5.57 How do I display a column of buttons such as pushbuttons or combobox buttons? I can run the project ok...
1
by: WT | last post by:
Hello, My 1.1 web site was using GetManifestResourceStream to get strategic .js files embedded as resources in the site assembly, but now it is no more allowed to embed resources by specifying a...
4
by: Scott F. Brown | last post by:
Greetings all... I was playing around with compressing streams and came across a behavior that I do not understand. I create a stream (input) from the contents of a textbox. That stream is...
6
by: CSharpProgrammer | last post by:
Hi, I followed an example that loads an embedded resource http://support.microsoft.com/kb/324567 That works just fine and dandy. My problem is that my namespaces are setup a bit differently....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.