This document is archived and information here might be outdated.  Recommended version.


ITOCControl2.Update Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Controls > ESRI ArcGIS Controls > Interfaces > IT > ITOCControl2 Interface > ITOCControl2.Update Method
ArcGIS Developer Help

ITOCControl2.Update Method

Updates the contents of the TOCControl to match its ActiveView.

[Visual Basic .NET]
Public Sub Update ( _
)
[C#]
public void Update (
);
[C++]
HRESULT Update(
void
);

Product Availability

Available with ArcGIS Engine.

Description

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.

Remarks

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.

 

[C#]

ITOCControl2 tocControl = (ITOCControl2) axTOCControl1.Object;
tocControl.ActiveView.FocusMap.get_Layer(0).Name = "myNewLayerName";
tocControl.Update();

[Visual Basic .NET]

Dim pTOCControl As ITOCControl2
pTOCControl = AxTOCControl1.Object
pTOCControl.ActiveView.FocusMap.Layer(0).Name = "myNewLayerName"
pTOCControl.Update()

See Also

ITOCControl2 Interface