Solved

Shared Image For Button.

Posted on 2008-10-03
8
204 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 1

Author Comment

by:emi_sastra
Comment Utility
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 6

Accepted Solution

by:
wwnosal earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Ok.

Thank you very much for your help.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

772 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now