This document is archived and information here might be outdated. Recommended version. |
ArcObjects namespaces > Controls > ESRI ArcGIS Controls > Interfaces > IT > ITOCControl2 Interface > ITOCControl2.Update Method (ArcObjects .NET 10.4 SDK) |
Updates the contents of the TOCControl to match its ActiveView.
[Visual Basic .NET]
Public Sub Update ( _
)
[C#] public void Update ( );
[C++]
HRESULT Update(
void
);
Updates the contents of the TOCControl based upon the ActiveView. Use the Update method after programmatically changing layer visibility and names, or changing any legend settings.
The TOCControl will automatically update its contents in response to IActiveViewEvents fired from the Buddy and the ITOCBuddyEvents::ActiveViewReplaced event that indicates a new document has been loaded into the Buddy or the object encapsulated by the Buddy has been replaced.
Use the Update method to update a Map which is not the FocusMap, as the IActiveViewEvents will only be triggered for the FocusMap.
ITOCControl2 tocControl=(ITOCControl2) axTOCControl1.Object;
tocControl.ActiveView.FocusMap.get_Layer(0).Name="myNewLayerName";
tocControl.Update();
Dim pTOCControl As ITOCControl2
pTOCControl=AxTOCControl1.Object
pTOCControl.ActiveView.FocusMap.Layer(0).Name="myNewLayerName"
pTOCControl.Update()