5

I have written an ArcMap Addin (ArcMap 10.0) that allows a user to perform a join between an in-memory table and a feature class (feature layer) added to the TOC. I want the attribute table of the feature layer to automatically refresh after the join occurs if the user happens to have the attribute table visible when performing the join. This way the fields added to the table via the join will be visible to the user without having to close and reopen the Attribute Table.

The following function is what I have tried to refresh the Attribute Table, but it does not actually refresh the display.

Private Sub RefreshAttributeTable()
    Try
        Dim tableWindow As ITableWindow3 = New TableWindow
        tableWindow.ActiveTableWindow.Refresh()

        My.ArcMap.Document.ActiveView.Refresh()
    Catch ex As Exception

        Debug.WriteLine(String.Format("{0}; {1}", ex.Message, ex.StackTrace))

    End Try
End Sub

Can anyone help with this?

1 Answer 1

3

Your code creates a new table window obj but does not set it to any existing table. You should pass a reference to the ITableWindow3 obj that you want to refresh into your sub. If you don't have the obj reference already then use ITableWindow3.FindOpenTableWindows method to get an ISet obj that you can then loop to find the desired window. I believe the tableWindow.ActiveTableWindow.Refresh() call will work once you have tableWindow set to an existing obj.

2
  • Did Rich's answer work? I'm trying ITableWindow3 tableWindow = new TableWindowClass(); tableWindow = (ITableWindow3)tableWindow.FindViaLayer((IFeatureLayer)outputLayer); tableWindow.ActiveTableWindow.Refresh(); and does not work.
    – user19055
    Commented Nov 27, 2013 at 18:50
  • I think it is best if you (user19055) ask a new question and post your code, then perhaps I can help. Commented Nov 28, 2013 at 1:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.