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

Stream and embedded bitmap

I am trying to roll my own control and am a bit stuck with the bitmap.

Private myBmp As Bitmap

Public Sub New()
Dim myStream As System.IO.Stream
myStream =
Me.GetType().Assembly.GetManifestResourceStream("b utton1.bmp") /* <-- this
resolves to Nothing, not System.Drawing.Bitmap */
myBmp = New Bitmap(myStream )
End Sub

In my solution's project I have a bitmap called button1.bmp with a build
action of Embedded Resource. Any ideas what I am doing wrong? the code and
the bitmap name are spelled the same.

Thanks,
Eric

Nov 20 '05 #1
2 1734
* "Eric Sabine" <mo*****@hyottmail.com> scripsit:
I am trying to roll my own control and am a bit stuck with the bitmap.

Private myBmp As Bitmap

Public Sub New()
Dim myStream As System.IO.Stream
myStream =
Me.GetType().Assembly.GetManifestResourceStream("b utton1.bmp") /* <-- this
resolves to Nothing, not System.Drawing.Bitmap */
myBmp = New Bitmap(myStream )
End Sub

In my solution's project I have a bitmap called button1.bmp with a build
action of Embedded Resource. Any ideas what I am doing wrong? the code and
the bitmap name are spelled the same.


Add the name of the root namespace in front of the filename
('GetManifestResourceStream("WindowsApplication1.b utton1.bmp")').
Notice that you don't need to add that to the filename!

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
Nov 20 '05 #2
Perfect! Very interesting too!

Thanks
Eric
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bo*************@ID-208219.news.uni-berlin.de...
* "Eric Sabine" <mo*****@hyottmail.com> scripsit:
I am trying to roll my own control and am a bit stuck with the bitmap.

Private myBmp As Bitmap

Public Sub New()
Dim myStream As System.IO.Stream
myStream =
Me.GetType().Assembly.GetManifestResourceStream("b utton1.bmp") /* <-- this resolves to Nothing, not System.Drawing.Bitmap */
myBmp = New Bitmap(myStream )
End Sub

In my solution's project I have a bitmap called button1.bmp with a build
action of Embedded Resource. Any ideas what I am doing wrong? the code and the bitmap name are spelled the same.


Add the name of the root namespace in front of the filename
('GetManifestResourceStream("WindowsApplication1.b utton1.bmp")').
Notice that you don't need to add that to the filename!

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>

Nov 20 '05 #3

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

Similar topics

3
by: bull.enteract | last post by:
Ok, I start off with a bitmap image. I encode it as a jpeg and send it across the network and pick it up on the other end. Now I have the jpeg image on the other end as an arrray of bytes and I...
2
by: stephen fx | last post by:
Hello all! Using C/C++ I can do this: struct MyStruct { int a; char b; }; MyStruct test;
8
by: TJ | last post by:
I need to be able to pass a pointer to a (managed code) Stream object to a COM method so it can serialize its data into the stream. I have a C# application that makes uses of Randolf Duke's...
11
by: Detlef Hüttenbach | last post by:
Whereas loading tiffs and pngs from file into an Image WebControl work, the images aren't shown when loaded from streams: In a WebForm, the image's property "ImageUrl" is set to a handler, and...
2
by: | last post by:
Hello All, I am writing a web application that reads a bitmap from a file and outputing it to a HTTP response stream to return the image to the requesting client. The image file is a regular...
2
by: creepwood | last post by:
I'm trying to load and image into a DB and alongside the image also a thumbnailed version of the image, but somewhere in my code, the stream doesn't take the thumbnail data. When I just change toe...
2
by: TC | last post by:
I would like to save bitmaps to a file stream, but I can't get the Bitmap.Save(Stream) overload to work. If I save one bitmap to the stream, it works okay, but if I save two or more, they all...
2
by: Julia Beresford | last post by:
Hi Al You can add a Bitmap to a VB class library and set it’s build action to embedded resource. How do you then get that image (i.e. load it into a PictureBox control) from another vb...
1
by: Tom Edelbrok | last post by:
I'm reading embedded bitmaps from an EXE project and everthing works fine. I do a GetExecutingAssembly, followed by setting a stream object to...
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
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
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
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.