Click here to Skip to main content
15,039,525 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a problem in arcgis c#. I am using Arcgis axMapControl component and adding image to it but I can not delete image when wanted to delete from axMapControl component... I have get a exception such as " The process cannot access the file C:\Users.. because it is being used by another process " I need your help :) and verryyy thankss for your helps :)

example code
public void Add_map()
  IRasterLayer my_raster = new RasterLayer();
public void Delete_map()
System.IO.File.delete(path);    //There is a Exception.... This problem...
Updated 12-Aug-12 22:51pm
Rajesh Varma Buddaraju 13-Aug-12 4:57am
Could you plz try to load the image from different path, Some times in IO process the files may get locked. If we found the problem it is very easy to fix.
mushack 28-Aug-12 9:59am
very thanks your anwers. well how to make IO process for unlock... can you tell me

"path" should be a valid path like "c:\filename.ext" etc. if it is a variable the you should be doing :
I gave an example... Path is valid but still I cannot delete image.... I used Dispose() method but still same the result :(
can someone help me :( very important.

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