468,457 Members | 1,608 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,457 developers. It's quick & easy.

Adding bitmaps to project

Hi there, I have a couple of bitmaps that are called in my project that I
need to use. They were added to my solution as existing objects and are
located in the same folder as the rest of the vb files.

I set their Build Action to Embedded Resource and compiled without any
errors, however, when calling them, like this inside Initialize Components:

myclosebutton.SetCloseBitmap(New Bitmap(MyClass.GetType(), "close.bmp"),
Color.FromArgb(255, 0, 255), New Point(127, 8))

I get this error:

An unhandled exception of type 'System.ArgumentException' occurred in
system.drawing.dll
Additional information: Resource 'close.bmp' could not be found in class
'InnerView.InnerView.main'.

Help!???
Thanks,
Derek
Nov 20 '05 #1
6 3008
Derek:

off the top of my head, I'm not sure. I think you need to reference the
project though. Here's the style I use regularly to get the info (not
saying this is better, but it definitely works)
case ImageName.RecordDisabled:
return new
Bitmap(System.Reflection.Assembly.GetExecutingAsse mbly().GetManifestResource
Stream("Project.Resource.jpg"));
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> wrote in message
news:ur**************@tk2msftngp13.phx.gbl...
Hi there, I have a couple of bitmaps that are called in my project that I
need to use. They were added to my solution as existing objects and are
located in the same folder as the rest of the vb files.

I set their Build Action to Embedded Resource and compiled without any
errors, however, when calling them, like this inside Initialize Components:
myclosebutton.SetCloseBitmap(New Bitmap(MyClass.GetType(), "close.bmp"),
Color.FromArgb(255, 0, 255), New Point(127, 8))

I get this error:

An unhandled exception of type 'System.ArgumentException' occurred in
system.drawing.dll
Additional information: Resource 'close.bmp' could not be found in class
'InnerView.InnerView.main'.

Help!???
Thanks,
Derek

Nov 20 '05 #2
Hmmm...well, I tried something similar to that and also went and found some
examples on the internet, nothing seems to be different in my setup than the
examples.

My startup object isn't the form that these are in, could that be the
trouble?

Thanks!
Derek
"William Ryan eMVP" <do********@comcast.nospam.net> wrote in message
news:OD****************@TK2MSFTNGP09.phx.gbl...
Derek:

off the top of my head, I'm not sure. I think you need to reference the
project though. Here's the style I use regularly to get the info (not
saying this is better, but it definitely works)
case ImageName.RecordDisabled:
return new
Bitmap(System.Reflection.Assembly.GetExecutingAsse mbly().GetManifestResource Stream("Project.Resource.jpg"));
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> wrote in message
news:ur**************@tk2msftngp13.phx.gbl...
Hi there, I have a couple of bitmaps that are called in my project that I need to use. They were added to my solution as existing objects and are
located in the same folder as the rest of the vb files.

I set their Build Action to Embedded Resource and compiled without any
errors, however, when calling them, like this inside Initialize

Components:

myclosebutton.SetCloseBitmap(New Bitmap(MyClass.GetType(), "close.bmp"),
Color.FromArgb(255, 0, 255), New Point(127, 8))

I get this error:

An unhandled exception of type 'System.ArgumentException' occurred in
system.drawing.dll
Additional information: Resource 'close.bmp' could not be found in class
'InnerView.InnerView.main'.

Help!???
Thanks,
Derek


Nov 20 '05 #3
I decided after fighting with it for quite some time to create a bitmap
right from within VS. Did an Add New Item, Bitmap File and saved it to the
solution. Properties set to Embedded Resource and changed the line to look
like this:
taskbarNotifier1.SetCloseBitmap(New Bitmap(MyClass.GetType(),
"Bitmap1.bmp"), Color.FromArgb(255, 0, 255), New Point(127, 8))
Same error - I MUST be doing something very small and wrong
consistently...anyone???

Thanks!
Derek
"William Ryan eMVP" <do********@comcast.nospam.net> wrote in message
news:OD****************@TK2MSFTNGP09.phx.gbl...
Derek:

off the top of my head, I'm not sure. I think you need to reference the
project though. Here's the style I use regularly to get the info (not
saying this is better, but it definitely works)
case ImageName.RecordDisabled:
return new
Bitmap(System.Reflection.Assembly.GetExecutingAsse mbly().GetManifestResource Stream("Project.Resource.jpg"));
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> wrote in message
news:ur**************@tk2msftngp13.phx.gbl...
Hi there, I have a couple of bitmaps that are called in my project that I need to use. They were added to my solution as existing objects and are
located in the same folder as the rest of the vb files.

I set their Build Action to Embedded Resource and compiled without any
errors, however, when calling them, like this inside Initialize

Components:

myclosebutton.SetCloseBitmap(New Bitmap(MyClass.GetType(), "close.bmp"),
Color.FromArgb(255, 0, 255), New Point(127, 8))

I get this error:

An unhandled exception of type 'System.ArgumentException' occurred in
system.drawing.dll
Additional information: Resource 'close.bmp' could not be found in class
'InnerView.InnerView.main'.

Help!???
Thanks,
Derek


Nov 20 '05 #4
Derek: I just used your bitmap name and stuck it in a project called
WindowsApplication10. I added a bitmap I had and called it Close.bmp to
match your situation. Worked without a glitch..you may want to use this
syntax:

Dim testBitmap As New
Bitmap(Reflection.Assembly.GetExecutingAssembly.Ge tManifestResourceStream("W
indowsApplication10.Close.bmp"))

Me.Button1.Image = testBitmap

"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> wrote in message
news:ur**************@tk2msftngp13.phx.gbl...
Hi there, I have a couple of bitmaps that are called in my project that I
need to use. They were added to my solution as existing objects and are
located in the same folder as the rest of the vb files.

I set their Build Action to Embedded Resource and compiled without any
errors, however, when calling them, like this inside Initialize Components:
myclosebutton.SetCloseBitmap(New Bitmap(MyClass.GetType(), "close.bmp"),
Color.FromArgb(255, 0, 255), New Point(127, 8))

I get this error:

An unhandled exception of type 'System.ArgumentException' occurred in
system.drawing.dll
Additional information: Resource 'close.bmp' could not be found in class
'InnerView.InnerView.main'.

Help!???
Thanks,
Derek

Nov 20 '05 #5
Okay, I got that working and that led me down a few more paths...I am
running the method that is calling my bitmap popup (see the toaster posts
below in NG if interested) in a thread which is not allowing it to push it
out correctly - jumps right over it.

SO - thanks so much for you help!!!! Now I just have to figure out how to
make that thing work in a thread and I am in business!

:-)

Derek
"William Ryan eMVP" <do********@comcast.nospam.net> wrote in message
news:OQ**************@tk2msftngp13.phx.gbl...
Derek: I just used your bitmap name and stuck it in a project called
WindowsApplication10. I added a bitmap I had and called it Close.bmp to
match your situation. Worked without a glitch..you may want to use this
syntax:

Dim testBitmap As New
Bitmap(Reflection.Assembly.GetExecutingAssembly.Ge tManifestResourceStream("W indowsApplication10.Close.bmp"))

Me.Button1.Image = testBitmap

"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> wrote in message
news:ur**************@tk2msftngp13.phx.gbl...
Hi there, I have a couple of bitmaps that are called in my project that I need to use. They were added to my solution as existing objects and are
located in the same folder as the rest of the vb files.

I set their Build Action to Embedded Resource and compiled without any
errors, however, when calling them, like this inside Initialize

Components:

myclosebutton.SetCloseBitmap(New Bitmap(MyClass.GetType(), "close.bmp"),
Color.FromArgb(255, 0, 255), New Point(127, 8))

I get this error:

An unhandled exception of type 'System.ArgumentException' occurred in
system.drawing.dll
Additional information: Resource 'close.bmp' could not be found in class
'InnerView.InnerView.main'.

Help!???
Thanks,
Derek


Nov 20 '05 #6
By the way, to get it to work, I had to put the bmp in the exe directory of
the project and make this line:

taskbarNotifier1.SetCloseBitmap(New Bitmap(MyClass.GetType(), "close.bmp"),
Color.FromArgb(255, 0, 255), New Point(127, 8))
Say this instead:
taskbarNotifier1.SetCloseBitmap("close.bmp", Color.FromArgb(255, 0, 255),
New Point(127, 8))
It works, but the downside is, obviously, the bmp isn't included in the exe
file which would allow someone to change it and that's bad, but I cannot for
the life of me get that first line example to work.
Any ideas?
Thanks,
Derek
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> wrote in message
news:Oz***************@tk2msftngp13.phx.gbl...
Okay, I got that working and that led me down a few more paths...I am
running the method that is calling my bitmap popup (see the toaster posts
below in NG if interested) in a thread which is not allowing it to push it
out correctly - jumps right over it.

SO - thanks so much for you help!!!! Now I just have to figure out how to
make that thing work in a thread and I am in business!

:-)

Derek
"William Ryan eMVP" <do********@comcast.nospam.net> wrote in message
news:OQ**************@tk2msftngp13.phx.gbl...
Derek: I just used your bitmap name and stuck it in a project called
WindowsApplication10. I added a bitmap I had and called it Close.bmp to
match your situation. Worked without a glitch..you may want to use this
syntax:

Dim testBitmap As New

Bitmap(Reflection.Assembly.GetExecutingAssembly.Ge tManifestResourceStream("W
indowsApplication10.Close.bmp"))

Me.Button1.Image = testBitmap

"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> wrote in message
news:ur**************@tk2msftngp13.phx.gbl...
Hi there, I have a couple of bitmaps that are called in my project that I need to use. They were added to my solution as existing objects and

are located in the same folder as the rest of the vb files.

I set their Build Action to Embedded Resource and compiled without any
errors, however, when calling them, like this inside Initialize

Components:

myclosebutton.SetCloseBitmap(New Bitmap(MyClass.GetType(), "close.bmp"), Color.FromArgb(255, 0, 255), New Point(127, 8))

I get this error:

An unhandled exception of type 'System.ArgumentException' occurred in
system.drawing.dll
Additional information: Resource 'close.bmp' could not be found in class 'InnerView.InnerView.main'.

Help!???
Thanks,
Derek



Nov 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Greg Merideth | last post: by
10 posts views Thread by Geoff Jones | last post: by
2 posts views Thread by Joe Wedel | last post: by
3 posts views Thread by _DS | last post: by
reply views Thread by Maqsood Ahmed | last post: by
reply views Thread by Narasimham | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.