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

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 3206
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Greg Merideth | last post by:
I'm amazed that putting an icon next to a menu item using c#, even from within visual studio, is so damm difficult. Does anyone have any code samples or tutorials on how to do this, amazingly...
10
by: Geoff Jones | last post by:
Hiya I hope somebody can help me with this relatively simple beginner question: I have created a windows Application in C#. I have also created a project, which includes a class. I have added...
6
by: UJ | last post by:
I have a couple of files (type definitions, constants, ...) that I want to use in multiple projects. How do I make it so that I have only one copy of the file for multiple projects? If I do add...
2
by: Joe Wedel | last post by:
I have a Solution with 4 Projects, one of which is not loading. I get the error message: Microsoft Development Environment Unable to read the project file 'CouncilAgenda.vbproj'. The project...
3
by: _DS | last post by:
The two obvious methods for ref'ing assemblies are: Add a reference and 'Browse' for the actual DLL OR Add existing project to the solution, then add a ref to 'Project'. 1: I'd like to...
0
by: Nick Zdunic | last post by:
When creating a Web Setup Project in VS 2005 and adding the project output from a web project, it doesn't appear that the dependencies are being added. The folder is blank when there should be...
0
by: Maqsood Ahmed | last post by:
Hello, I have converted an application from .net 1.1 to .net 2.0. I added a Windows Installer project to the solution and all worked well. Now I want to bind the solution to source control (VSS...
1
by: Sala | last post by:
Hi creative thinkers ! I have one project in C# .. that project name ewaoNET . Now i will shifted into another project sub folders.... My current Project : Cititown Now i will use existing (...
0
by: Narasimham | last post by:
Hi, I was able to successfully create a new project using the devenv command line arguments. I did devenv /command np and then specified the name of the project and its location in the
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: 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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.