Click here to Skip to main content
15,890,897 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
Help me solve this problem:

When working on my project (win application), I need to remove a resource(picture) from the project.

But, When I run the project - it gives an error message.

Error Message:
Code generation for property 'Items' failed. Error was: 'Could not find file 'C:\Users\Administrator\Desktop\org\org\org\Resources\black-bugatti-veyron.jpg'.'
Posted
Updated 12-Sep-12 20:33pm
v2
Comments
ali_heidari_ 13-Sep-12 2:28am    
well you said you need to remove your pictures then how you hope to find them there?
mhassan083 13-Sep-12 2:36am    
i'm already remove the picture and when run appear error message
ali_heidari_ 13-Sep-12 2:51am    
i think you removed them but you forget to remove code that is reletive to your removed pictures , thats why your app think you need work with unexist pictures ...
mhassan083 13-Sep-12 3:21am    
in resourses file i commented the code belong this picture but i don't know if this code is the only code belong this picture that remove,thanks sir

1 solution

Hi,

probably you may have given the wrong path. try by giving the root path like below.

C#
string ImagePath = @"~\Resources\black-bugatti-veyron.jpg";
if(File.Exists(ImagePath))
{
  //Delete the file here
}


hope it works.
 
Share this answer
 
Comments
mhassan083 13-Sep-12 2:43am    
when i need to remove any resources i need to write this code ??
i'm already remove the picture and when run appear error message.
this my problem sir,
Karthik Harve 13-Sep-12 3:00am    
this is to remove only that particular image. put this "if" condition, then you will not get that error message.
mhassan083 13-Sep-12 3:08am    
thanks,but i'm beginner
where i put this code(form load or where) and what should be in the body of if cond. when try my sir, File after if replace with what because File make error
when try .
Karthik Harve 13-Sep-12 3:22am    
Just enclose the code that you have currently written for deleing the image, with the "IF" block.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900