Select to view content in your preferred language

Update View  of Attribute Table in ArcMap (Reload Cache)

2306
1
06-03-2010 01:16 AM
chriss_
Emerging Contributor
Hi!

I've a VBA Code that changes some values in an attribute table. Now I want to refresh the view of the attribute table automatically. So if I leave the attributetable open during I run the Code I want to see the updated values right away without using the "reload chache" button. What I am looking for is something like the "refresh cache" button under options in the attribute table

I tried with

MxDoc.UpdateContents
MxDoc.ActivatedView.Refresh

but this doesn't work.

Any idea how to do that?

Thanks
Chris
0 Kudos
1 Reply
DuncanHornby
MVP Notable Contributor
I know this is 3 years too late 😄 but I was just trying to do the same thing in VB .net. Anyway here is my code developed in VB .net for ArcGIS 10.1 hope it helps others.

Duncan

Sub ReloadTableCache(ByRef pTable As ITable)
   ' QI to IDataset so we can get Table name
   Dim pDataset As IDataset
   pDataset = DirectCast(pTable, IDataset)

   ' Get a handle on open tables
   Dim pTableWindow As ITableWindow3
   pTableWindow = New TableWindowClass
   Dim pSet As ISet = Nothing
   pTableWindow.FindOpenTableWindows(pSet)
   If pSet Is Nothing Then Exit Sub ' No tables open, bail out

   ' Search open tables and reload cache if table if found
   pSet.Reset()
   Dim pStandaloneTable As IStandaloneTable
   Dim pTW As ITableWindow3
   pTW = DirectCast(pSet.Next, ITableWindow3)
   Do While Not pTW Is Nothing
       pStandaloneTable = pTW.StandaloneTable
       If pStandaloneTable.Name = pDataset.Name Then
           ' Matching table found, reload cache
           Dim pTableControl As ITableControl
           pTableControl = pTW.TableControl
           pTableControl.RemoveAndReloadCache()
           Exit Do
       End If
       pTW = DirectCast(pSet.Next, ITableWindow3)
   Loop
End Sub
0 Kudos