473,385 Members | 1,872 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,385 software developers and data experts.

Embedded images?

I'm trying to use an embedded image(bitmap) using the following code:

imgDrag = New
System.Drawing.Bitmap(GetType(QueryResultGrid).Ass embly.GetManifestResourceS
tream("Comp.Tech.QueryResultGrid.ResultsGridDrag.b mp"))

Where QueryResultGrid is the class thats going to use the image,
Comp.Tech.QueryResultGrid is the assembly name and ResultsGridDrag.bmp is
the file name of the embedded resource. However, on runing this line I get:

An unhandled exception of type 'System.ArgumentException' occurred in
system.drawing.dll
Additional information: 'null' is not a valid value for 'stream'.

Any ideas why? I think that maybe I should be using something other than
"Comp.Tech.QueryResultGrid.ResultsGridDrag.bmp "?

--

Cheers,

elziko
Nov 20 '05 #1
2 1350
Hi,

Here is an example. I added the water lilies.jpg to my app get its
build action to embedded resource.
Dim bm As Bitmap

Dim myAsm As System.Reflection.Assembly =
System.Reflection.Assembly.GetExecutingAssembly()

bm = New Bitmap(myAsm.GetManifestResourceStream(Me.GetType, "Water
lilies.jpg"))

Ken

---------------

"elziko" <el****@NOTSPAMMINGyahoo.co.uk> wrote in message
news:40***********************@news.easynet.co.uk. ..
I'm trying to use an embedded image(bitmap) using the following code:

imgDrag = New
System.Drawing.Bitmap(GetType(QueryResultGrid).Ass embly.GetManifestResourceS
tream("Comp.Tech.QueryResultGrid.ResultsGridDrag.b mp"))

Where QueryResultGrid is the class thats going to use the image,
Comp.Tech.QueryResultGrid is the assembly name and ResultsGridDrag.bmp is
the file name of the embedded resource. However, on runing this line I
get:

An unhandled exception of type 'System.ArgumentException' occurred in
system.drawing.dll
Additional information: 'null' is not a valid value for 'stream'.

Any ideas why? I think that maybe I should be using something other than
"Comp.Tech.QueryResultGrid.ResultsGridDrag.bmp "?

--

Cheers,

elziko

Nov 20 '05 #2
* "elziko" <el****@NOTSPAMMINGyahoo.co.uk> scripsit:
I'm trying to use an embedded image(bitmap) using the following code:

imgDrag = New
System.Drawing.Bitmap(GetType(QueryResultGrid).Ass embly.GetManifestResourceS
tream("Comp.Tech.QueryResultGrid.ResultsGridDrag.b mp"))

Where QueryResultGrid is the class thats going to use the image,
Comp.Tech.QueryResultGrid is the assembly name and ResultsGridDrag.bmp is
the file name of the embedded resource. However, on runing this line I get:

An unhandled exception of type 'System.ArgumentException' occurred in
system.drawing.dll
Additional information: 'null' is not a valid value for 'stream'.

Any ideas why? I think that maybe I should be using something other than
"Comp.Tech.QueryResultGrid.ResultsGridDrag.bmp "?


Does it work it you use something like that?

Add the image, set its 'Build Action' to 'Embedded Resource', then you
can use this code to load the bitmap:

\\\
Me.picMyPicture.Image = _
New Bitmap( _
System.Reflection.Assembly.GetExecutingAssembly(). GetManifestResourceStream( _
"<Root namespace>.<File name>" _
) _
)
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

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

Similar topics

0
by: Philipp Seidel | last post by:
Hi there! I did not know, where this topic fits in, so I put it here. I have a minor problem with embedded resources, which puzzles me quite a lot. I'd be glad if anyone can help me on this: ...
1
by: unotin | last post by:
I have an application in ASP that exports to Word using the Response.ContentType method. The application references another ASP page through the img tag that uses a Response.BinaryWrite (of an...
1
by: Zeroeffect | last post by:
Hello! I have a database with alot of embedded images. The reason for having the images embedded is security. My problem is that it works fine on my computer, but not on my clients computer....
0
by: Tom | last post by:
I'm creating a demo database with three records. The finished database will have linked images but for the demo I want to keep everything in the same file. How do I create three embedded images,...
1
by: Hans Kesting | last post by:
Hi, I know how to send emails from the .Net environment, even html mails. But, what is the best way to add images to the html? A URL to an image somewhere on some server is usually blocked...
0
by: Vladi | last post by:
Hello everybody, I have a asp.net 1.1 page which has the following controls: 4 Images whose src points to an image.aspx file which returns a different jpg from a DB 1 flash object on top of those...
2
by: Grant Harmeyer | last post by:
I have a project where I am required to embed a few images and CSS files in the assembly (v1.1) and read them out at runtime. I know that this can be done using an HttpHandler/.axd file (like the...
7
by: Trapulo | last post by:
Hello, I need to send an email from vb.net. The body may be html encoded, and all images related to the html (<img src....>) may be embedded in the email content instead of refer to remote urls. ...
1
by: mark | last post by:
I'm using System.Net.Mail to send HTML email. I have a few images embedded within the HTML body. What's the most efficient way of including these images with the message or getting the images to...
8
by: Fred* | last post by:
Hello, I'm using Visual C# 2005 Express. if I create a new "application windows" project and run it (F5), it works well. (an empty window is launched..) as soon as I set the build action to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.