ThinkGeo.com    |     Documentation    |     Premium Support

Editing ShapeFile when using multiple indexes

I used your code project code to generate multiple indexes from a single shapefile, and it works great.  I now want to be able to edit the contents of the shapefile, but everytime a ShapeFileFeatureLayer is set to be in read/write mode, the program crashes saying the file is being used by another process.  Is there any way to get around this using multiple indexes on the same shapefile, or is this just a limitation when using this strategy?


Thanks for your help,


.Ryan.



Can you give us a little more background on what type of editing you are doing? Are you editing the physical data or just the attribute data? Also, it would help if you could send us the code you are using. I don’t think that using multiple indexes on a single shapefile is meant to also allow editing besides viewing but, from your further explantions, we will try to reproduce your conditions on our side and try to find a solution. Thank you.

I've create a quick sample that uses the MajorCities shapefile provided in the sample data folder created on install of Map Suite.  If possible, I would like to be able to edit both the shape it self along with the data associated with it in the dbf file.  I have a couple of optoins of things I can do if it is not possible to do this with multiple indexes, this would just be the easiest.


Thanks for your help,


.Ryan.



1751-MultiIndexSample.zip (12.2 KB)

Ryan, 
  
 I can recreate your problem by using the sample attached, I found the problem is that you create two layers and they load the same shape files, it works when set the mode to ReadOnly, but you set one layer’s mode to ReadWrite. I think you have the reason to keep the ReadWrite mode. 
  
 From your code, I guess your requirement is that you want to set the different styles between capitals and cities and you also want to edit this shape file. So my suggestion is that you can use ValueStyle to do it, value style also can set different styles for different column values, the performance is a little worse than multi indexes, but you can write shape file as well. 
  
 Please let me know if ValueStyle is not you want. 
  
 Thanks 
  
 James