<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Error of re-adding shapefiles into AGX in ArcGIS Explorer Desktop Questions</title>
    <link>https://community.esri.com/t5/arcgis-explorer-desktop-questions/error-of-re-adding-shapefiles-into-agx/m-p/198674#M1280</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dear all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using AGX SDK (VB2008) to build a customized interface&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I create one button to add the shpaefile as featurelayer into AGX&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim TestLayer As FeatureLayer &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TestLayer=FeatureLayer.OpenShapefile("C:\test.shp")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;map.ChildItems.Add(TestLayer)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also create another button to remove it &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TestLayer.RemoveFromParent()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TestLayer.ClearCache()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TestLayer.Disconnect()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But when I remove the shapefile and want to add it again, I got this error message:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Failed to create a valid association from a featurelayer to a table"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am not quite understand what is that mean, can anyone help me here?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a lot in advance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ethan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Jun 2010 18:43:48 GMT</pubDate>
    <dc:creator>Yi-ChenYang</dc:creator>
    <dc:date>2010-06-24T18:43:48Z</dc:date>
    <item>
      <title>Error of re-adding shapefiles into AGX</title>
      <link>https://community.esri.com/t5/arcgis-explorer-desktop-questions/error-of-re-adding-shapefiles-into-agx/m-p/198674#M1280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dear all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using AGX SDK (VB2008) to build a customized interface&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I create one button to add the shpaefile as featurelayer into AGX&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim TestLayer As FeatureLayer &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TestLayer=FeatureLayer.OpenShapefile("C:\test.shp")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;map.ChildItems.Add(TestLayer)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also create another button to remove it &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TestLayer.RemoveFromParent()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TestLayer.ClearCache()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TestLayer.Disconnect()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But when I remove the shapefile and want to add it again, I got this error message:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Failed to create a valid association from a featurelayer to a table"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am not quite understand what is that mean, can anyone help me here?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a lot in advance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ethan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jun 2010 18:43:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-explorer-desktop-questions/error-of-re-adding-shapefiles-into-agx/m-p/198674#M1280</guid>
      <dc:creator>Yi-ChenYang</dc:creator>
      <dc:date>2010-06-24T18:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: Error of re-adding shapefiles into AGX</title>
      <link>https://community.esri.com/t5/arcgis-explorer-desktop-questions/error-of-re-adding-shapefiles-into-agx/m-p/198675#M1281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ethan,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You might like to try using:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Application.ActiveMapDisplay.Map.ChildItems.Remove(TestLayer) &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This works fine - as does re-adding the layer afterwards using the OpenShapefile method in your example code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Calling Disconnect() is probably unnecessary (and may be the cause of your problem - unfortunately I didn't go as far as to test this) but you can call ClearCache() if you want to explicitly clear out the disk cache.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jun 2010 09:26:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-explorer-desktop-questions/error-of-re-adding-shapefiles-into-agx/m-p/198675#M1281</guid>
      <dc:creator>MichaelBranscomb</dc:creator>
      <dc:date>2010-06-30T09:26:18Z</dc:date>
    </item>
  </channel>
</rss>

