Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Shared Image For Button.

Posted on 2008-10-03
8
Medium Priority
?
212 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

715 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