This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ESRI.ArcGIS.Snippets > Snippets > Get Selected Table in Contents View Snippet (ArcObjects .NET 10.4 SDK) |
Returns a reference to the currently selected table in the given contents view.
///<summary>Returns a reference to the currently selected table in the given contents view.</summary> /// ///<param name="currentContentsView">An IContentsView interface.</param> /// ///<returns>An ITable interface or Nothing if not found.</returns> /// ///<remarks></remarks> public ESRI.ArcGIS.Geodatabase.ITable GetSelectedTableInContentsView(ESRI.ArcGIS.ArcMapUI.IContentsView currentContentsView) { if (currentContentsView != null && currentContentsView.SelectedItem is ESRI.ArcGIS.Geodatabase.ITable) { ESRI.ArcGIS.Geodatabase.ITable table=(ESRI.ArcGIS.Geodatabase.ITable)currentContentsView.SelectedItem; return table; } return null; }
'''<summary>Returns a reference to the currently selected table in the given contents view.</summary> ''' '''<param name="currentContentsView">An IContentsView interface.</param> ''' '''<returns>An ITable interface or Nothing if not found.</returns> ''' '''<remarks></remarks> Public Function GetSelectedTableInContentsView(ByVal currentContentsView As ESRI.ArcGIS.ArcMapUI.IContentsView) As ESRI.ArcGIS.Geodatabase.ITable If Not currentContentsView Is Nothing AndAlso TypeOf currentContentsView.SelectedItem Is ESRI.ArcGIS.Geodatabase.ITable Then Dim table As ESRI.ArcGIS.Geodatabase.ITable=CType(currentContentsView.SelectedItem, ESRI.ArcGIS.Geodatabase.ITable) Return table End If Return Nothing End Function