Hello
i hope this is the right subforum. I created arcmap addin in c# some data export into shape. When the tool is done and the shape files are ready for use i get the following error upon trying to pull them onto the ArcMap's table of content:
One or more layers failed to draw:
586537922002012111601_ILL: Cannot acquire a lock.
586537922002012111601_ILL: Cannot acquire a lock.
586537922002012111601_IPL: Cannot acquire a lock.
586537922002012111601_IPL: Cannot acquire a lock.
586537922002012111601_ITL: Cannot acquire a lock.
586537922002012111601_ITL: Cannot acquire a lock.
What could be locking my files?
this is where i create shape files
...
...
//Get the factory
ShapefileWorkspaceFactory factory = new ShapefileWorkspaceFactory();
//Create a workspace
IWorkspaceName workspaceName = factory.Create(IzvozHelper.wrkdir.Substring(0, 3), IzvozHelper.wrkdir.Substring(3, IzvozHelper.wrkdir.Length - 3), null, 0);
IName name = (IName)workspaceName;
//QI to IFeatureWorkspace
IFeatureWorkspace featWorkspace = (IFeatureWorkspace)name.Open();
//Create FeatureClass
var filename = getFileName(int.Parse(IzvozHelper.tip)).Substring(1, getFileName(int.Parse(IzvozHelper.tip)).Length - 1);
globalFileName = filename;
var fullname = IzvozHelper.wrkdir + "\\" + filename;
string[] fileList = System.IO.Directory.GetFiles(IzvozHelper.wrkdir, filename + ".*");
try
{
foreach (string s in fileList)
{
if (s.EndsWith("shp") || s.EndsWith("shx") || s.EndsWith("dbf") || s.EndsWith("prj"))
File.Delete(s);
}
}
catch (IOException e)
{
MessageBox.Show("xxxxx!\r\n" + e.ToString());
}
//if (IzvozHelper.tip == "1")
featWorkspace.CreateFeatureClass(filename, fields, null, null, esriFeatureType.esriFTSimple, shapeFieldName, "");
return featWorkspace.OpenFeatureClass(filename);
}