Solved

Shared Image For Button.

Posted on 2008-10-03
8
208 Views
Last Modified: 2010-04-23
Hi,

I have windows form that consist of buttons and its of the button have image.
The problem is when copy from one project to another project the image of the button is gone.

The images are save in one folder.

How to solve this problem?

Thank you.
0
Comment
Question by:emi_sastra
  • 4
  • 4
8 Comments
 
LVL 6

Expert Comment

by:wwnosal
ID: 22634138
Create a resource file in which you will add the images, then you will copy it to new project and you have it there.

Right click on project -> resources, add resource, new image  and pick the type of image you are using.


hope this helps.


0
 
LVL 1

Author Comment

by:emi_sastra
ID: 22634306
Hi wwnosal,

I don't get it.

Let's say I have 3 folder:

1. Image.
2. Project1.
3. Project2.

Project1 has done perfectly with buttons and image on it.

Project1 still open.

Then I create new project (not copied from Project1), add new form (form1) and copy groupbox of button from form of project1 to form1 of project2. After that the images of buttons in form1 of project2 is gone.

Thank you.
0
 
LVL 6

Expert Comment

by:wwnosal
ID: 22634526
How are you placed image on buttons and which IDE you are using. By adding image from properties window on my VS 2005 Express scenario described by you is working correctly, so I have everything copied.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:emi_sastra
ID: 22634582
At project1, I add button to a form and add image using button image property. Choose project resource file.

What's the different between project resource file and local resource ?

Thank you.
0
 
LVL 6

Accepted Solution

by:
wwnosal earned 500 total points
ID: 22634689
OK that's clear now. Resource file is "Project specific" which means that you are adding your graphics into resource file of Project1. In order to have it available after copying the buttons, you would also need to copy the resource file.

If you import from local resource the absolute path to the image is stored and then it will work with Project2 without any other compliations.

To picture it a bit it is in the follwing way:

1. Resource file:
 IDE will look for your image in file ...../ProjectName/ResourceFileName
2. Local resource

Assuming you work on drive D

IDE will look for your image in file D:/your/path/to/image

Furthermore if your not change the resource file name which is Resources.resx it is auto generated.
So in your case your adding image to file Project1/MyProject/Resources.resx but it is searched to be in Project2/MyProject/Resources.resx.


I think you can share a resource file among more projects if you give it a different name than the standard one. Please try doing that. If this not helps find your Resources.resx and copy it into Project2.



0
 
LVL 1

Author Comment

by:emi_sastra
ID: 22634765
Yes, in other word I should use Local Resource, Import then I could copy it to other form without have to worry the resource file.

Using Local Resouce, there is no images added to the project resource file?

Thank you.
0
 
LVL 6

Expert Comment

by:wwnosal
ID: 22634838
Yes use local resource or global resource file but with different name than the standard one (and best located somewhere globally)!
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 22634891
Ok.

Thank you very much for your help.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question