AnsweredAssumed Answered

Closing Table Window Docking Pane with ITableDocWindowAdmin

Question asked by johnnhansen on Mar 14, 2013
Latest reply on Mar 18, 2013 by geonetadmin

I wish to close the table window docking pane via an addin button. I am using Visual C# 2010 Express. The map user will start with one or more attribute tables open (see two_open_attribute_tables.jpg). I am able to close any/all open attribute tables with this code:

[INDENT]//using ESRI.ArcGIS.ArcMapUI;
//using ESRI.ArcGIS.Framework;
//using ESRI.ArcGIS.esriSystem;
//using ESRI.ArcGIS.Carto;

IMxDocument pMxDoc = ArcMap.Document;
IMap pMap = pMxDoc.FocusMap;
IContentsView pTOC = pMxDoc.CurrentContentsView;
IApplication application = ArcMap.Application;
ITableWindow pTableWindow = new TableWindowClass();
pTableWindow.Application = application;
ITableWindow3 pTableWindow3 = pTableWindow as ITableWindow3;

ISet pTableSet = new SetClass();
pTableWindow3.FindOpenTableWindows(out pTableSet);
ITableWindow pTableWindowTemp = pTableSet.Next() as ITableWindow;
while (pTableWindowTemp != null)
pTableWindowTemp = pTableSet.Next() as ITableWindow;[/INDENT]}[/INDENT]

This, however, leaves me with an open (and empty) table window pane (see no_open_attribute_windows.JPG). The ITableDocWindowAdmin interface has a close method that should close the window pane (, but I have been unsuccessful in passing the pTableWindow or pTableWindow3 to that interface (admittedly, I am in way over my head here). I have also attempted to use the IDockableWindowManager to no avail. Here are some of my (failed) approaches:
//ITableDockWindowAdmin pDockWidowAdmin = new TableDockWindowClass();

//ITableDockWindowAdmin pDockWidowAdmin = application as ITableDockWindowAdmin;

//ITableDockWindowAdmin pDockWidowAdmin = new TableDockWindowClass();//application as ITableDockWindowAdmin;
//ITableWindow pTableWindowToClose = new TableWindowClass();//(ITableWindow)pTableWindow3;
//pTableWindowToClose.Application = application;

Any ideas? I have an Esri Incident open, but they have not been able to help.