Refresh open Table in Arcamp

1690
14
09-15-2013 04:19 AM
UrsRichard
New Contributor II
I "stamp" a position with the GPS-Tool to the Log-File saved in a filegeodatabase. In the map and the table window I always like to show the actual Log-File. I can refresh the view but not the opened table window. I always have to close and open the table window. I tried to refresh the table but nothing seems to have the effect to reload the actual data from the underlying featureclass (log-file). How can refresh the table window?

Dim pCmdItem As ICommandItem
            Dim pUID As New UIDClass()
            pUID.Value = "{256176AD-0C33-406C-9ED8-9F7AC784A3E3}"
            pCmdItem = My.ArcMap.Application.Document.CommandBars.Find(pUID)
            pCmdItem.Execute()

            Dim tableWindow As ITableWindow3 = New TableWindow
            Dim pSet As ISet = Nothing
            tableWindow.Application = My.ArcMap.Application
            tableWindow.FindOpenTableWindows(pSet)
            pSet.Reset()
            tableWindow = pSet.Next
            While Not tableWindow Is Nothing
                If tableWindow.IsOpen Then                                  
                    tableWindow.TableControl.RemoveAndReloadCache()
                    tableWindow.Refresh()
                End If
                tableWindow = pSet.Next
            End While
0 Kudos
14 Replies
RichardFairhurst
MVP Honored Contributor
I am not sure I have a solution, but I am curious why you didn't use the TableControl Redraw method?

                    tableWindow.TableControl.RemoveAndReloadCache()
                    tableWindow.TableControl.Redraw()
0 Kudos
UrsRichard
New Contributor II
Still no success. Are there other solutions refreshing an open attribute table in ArcMap?

            Dim pCmdItem As ICommandItem
            Dim pUID As New UIDClass()
            pUID.Value = "{256176AD-0C33-406C-9ED8-9F7AC784A3E3}"
            pCmdItem = My.ArcMap.Application.Document.CommandBars.Find(pUID)
            pCmdItem.Execute()

            Dim tableWindow As ITableWindow3 = New TableWindow
            Dim pSet As ISet = Nothing
            tableWindow.Application = My.ArcMap.Application
            tableWindow.FindOpenTableWindows(pSet)
            pSet.Reset()
            tableWindow = pSet.Next
            While Not tableWindow Is Nothing
                If tableWindow.IsOpen Then
                    tableWindow.TableControl.RemoveAndReloadCache()
                    tableWindow.TableControl.Redraw()
                    tableWindow.Refresh()
                End If
                tableWindow = pSet.Next
            End While
0 Kudos
AlexanderGray
Occasional Contributor III
if you reload cache for the GUI do you get the new rows?  Have you tried callind EditChanged on the Table view before removeAndReloadCache?  The GUI's ability to refresh the table depends on how the edit was done.  In an edit session with an edit operation, the proper messages to say the table was updated should have been sent, it is quite tricky.
0 Kudos
UrsRichard
New Contributor II
I don't get new Rows and EditChange work neither.

           Dim pCmdItem As ICommandItem
            Dim pUID As New UIDClass()
            pUID.Value = "{256176AD-0C33-406C-9ED8-9F7AC784A3E3}"
            pCmdItem = My.ArcMap.Application.Document.CommandBars.Find(pUID)
            pCmdItem.Execute()

            Dim tableWindow As ITableWindow3 = New TableWindow
            Dim pSet As ISet = Nothing
            tableWindow.Application = My.ArcMap.Application
            tableWindow.FindOpenTableWindows(pSet)
            pSet.Reset()
            tableWindow = pSet.Next
            While Not tableWindow Is Nothing
                If tableWindow.IsOpen Then
                    tableWindow.TableControl.EditChanged()
                    tableWindow.TableControl.RemoveAndReloadCache()
                    tableWindow.TableControl.Redraw()
                    tableWindow.Refresh()
                End If
                tableWindow = pSet.Next
            End While
0 Kudos
LeoDonahue
Occasional Contributor III
0 Kudos
UrsRichard
New Contributor II
Still no refreshing. But if I reorder the Table with the GUI the attribute table will be reloaded correct. Is there a way to reorder the open attribute table with ArcObjects?
0 Kudos
LeoDonahue
Occasional Contributor III
>> But if I reorder the Table with the GUI

Explain?
0 Kudos
AlexanderGray
Occasional Contributor III
Do you have a query filter on the layer by any chance?
0 Kudos
UrsRichard
New Contributor II
>> But if I reorder the Table with the GUI

Explain?


I can reorder the table either with close and reopen again or with resorting the the table. Both ways work only manualy (working with the the mouse) in ArcMap.
0 Kudos