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


ITOCControl.Update Method (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (Controls)  

ITOCControl.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#]

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

[Visual Basic .NET]

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

See Also

ITOCControl Interface

.NET Samples

ArcGIS Network Analyst extension Engine application (Code Files: frmMain)