mushack

arcgis Map c# The process cannot access the file C:\Users.. because it is being used

Discussion created by mushack on Aug 13, 2012
Latest reply on Aug 27, 2012 by mushack
0  down vote  favorite


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 :)

code

    public void Add_map()
     {
      IRasterLayer my_raster = new RasterLayer();
      my_raster.FromFile(path);
      AxMapControl1.AddLayer(my_raster);
    }
    //--------------------------------------------------
    public void Delete_map()
    {
    AxMapControl1.DeleteLayer(0);
    System.IO.File.delete(path);    //There is a Exception.... This problem...
   }

Outcomes