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

problem with pictuerbox

ma
Hello,

I am new in .NET and I am writing my first program in c++/CLI on MSVC
2005.

I add a PictureBox to my form and then using its properties I change its
image property to one image from my hard disk. it generate the following
code for me:

this->image1->Image = (cli::safe_cast<System::Drawing::Image^
(resources->GetObject(L"image1.Image")));


but when I am running my program, it generate an exception with the error
that it couldn't find the specified objects in my resources. I checked the
resource and there is no resource with this name there.

What is wrong with this?

Best regards


Mar 12 '06 #1
5 1731
> but when I am running my program, it generate an exception with the error
that it couldn't find the specified objects in my resources. I checked
the
resource and there is no resource with this name there.

What is wrong with this?


As I mentioned in vc.language, It should work, so you have to find out why
it doesn't get added.
Have you tried to add image1 manually?

double click the resource, select 'images' in the top left of the resource
window.
that way you see what images exist.
In the resource window, Select Add resource->New image then select the
correct extension and add your image manually.

--

Kind regards,
Bruno.
br**********************@hotmail.com
Remove only "_nos_pam"
Mar 12 '06 #2
ma
Thanks for your suggestion.
I did some more work and I found that the resouirce is actually there but
when I try to read it i am getting the following error:
An unhandled exception of type
'System.Resources.MissingManifestResourceException ' occurred in mscorlib.dll

Additional information: Could not find any resources appropriate for the
specified culture or the neutral culture. Make sure
"test_win_form.MainForm.resources" was correctly embedded or linked into
assembly "test_win_form" at compile time, or that all the satellite
assemblies required are loadable and fully signed.

what is culture?

best regards

"Bruno van Dooren" <br**********************@hotmail.com> wrote in message
news:OT*************@TK2MSFTNGP10.phx.gbl...
but when I am running my program, it generate an exception with the error
that it couldn't find the specified objects in my resources. I checked
the
resource and there is no resource with this name there.

What is wrong with this?


As I mentioned in vc.language, It should work, so you have to find out why
it doesn't get added.
Have you tried to add image1 manually?

double click the resource, select 'images' in the top left of the resource
window.
that way you see what images exist.
In the resource window, Select Add resource->New image then select the
correct extension and add your image manually.

--

Kind regards,
Bruno.
br**********************@hotmail.com
Remove only "_nos_pam"

Mar 12 '06 #3
> Thanks for your suggestion.
I did some more work and I found that the resouirce is actually there but
when I try to read it i am getting the following error:
An unhandled exception of type
'System.Resources.MissingManifestResourceException ' occurred in mscorlib.dll

Additional information: Could not find any resources appropriate for the
specified culture or the neutral culture. Make sure
"test_win_form.MainForm.resources" was correctly embedded or linked into
assembly "test_win_form" at compile time, or that all the satellite
assemblies required are loadable and fully signed.

what is culture?


If you want users from different countries to be able to use your
application in their native language, you can use localization.

if you look at the propery page of your windows form, there is a property
called language. if you select a language there, every make-up action you
perform on the form will be tied to that language.

For example, in your case this would mean that you would have 2 pictures for
2 languages. the language is determine by the localization settings in the
windows control panel.

If the program runs on a computer for which there is no specific resource,
the program will try to load the language 'neutral' resource.

I suggest you do the following: In your resource file (if you right click it
in the solution explorer ->view code) you can see the language for which the
picture was added. In my project this is neutral (the default setting).
My guess is that whatever you find there is not neutral, and different from
the locale of your machine.

When you start your app, the program will try to load the resource for the
locale of your machine, does not find it, tries to load the neutral resource,
cannot find it and finally throws an exception.

--

Kind regards,
Bruno.
br**********************@hotmail.com
Remove only "_nos_pam"

Mar 13 '06 #4
ma
Thanks for your good explanation.

I check and found that the language of my form is default and in the
resource the culture is neutral

See the extract from my form resource:

assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

<data name="pictureBox1.Image" type="System.Drawing.Bitmap, System.Drawing"
mimetype="application/x-microsoft.net.object.bytearray.base64">

<value>

What should I do now?

Best regards
Mar 13 '06 #5


"ma" wrote:
Thanks for your good explanation.

I check and found that the language of my form is default and in the
resource the culture is neutral

See the extract from my form resource:

assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

<data name="pictureBox1.Image" type="System.Drawing.Bitmap, System.Drawing"
mimetype="application/x-microsoft.net.object.bytearray.base64">

<value>

What should I do now?

Best regards


This should be OK.
Btw I just realized that your form has localization disabled .otherwise you
won't get the explicit initialization of the picturebox directly in your code.

However, your code contains this:
resources->GetObject(L"image1.Image")));
but your resource file contains this:
<data name="pictureBox1.Image"

the names don't match. there is no image1.image in your resource file.
try to change the name of the resource that initializecomponent tries to
load to the name that is in your resource file. they should be the same.

--

Kind regards,
Bruno.
br**********************@hotmail.com
Remove only "_nos_pam"

Mar 13 '06 #6

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

Similar topics

0
by: Bruce Davis | last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded tkinter gui application. The problem appears to be a deadlock condition when a child thread pops up a Pmw dialog window in...
11
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
0
by: Refky Wahib | last post by:
Hi I need Technical Support I finished a Great project using .Net and SQL Server and .Net Mobile Control My Business case is to implement this Program to accept about 1 Million concurrent...
9
by: Sudesh Sawant | last post by:
Hello, We have an application which communicates using remoting. There is a server which is a Windows Service. The server exposes an object which is a singleton. The client is a Web Application...
117
by: Peter Olcott | last post by:
www.halting-problem.com
17
by: Jon Slaughter | last post by:
I'm having a little trouble understanding what the slicing problem is. In B.S.'s C++ PL3rdEd he says "Becayse the Employee copy functions do not know anything about Managers, only the Employee...
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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?
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
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...

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.