Changing label visibility programmatically

Last Published: April 25, 2020


At ArcGIS 9.3 and 9.3 Service Pack 1, ForceElementLayer implements the IEnumAttributeLabel interface. Therefore, to change label visibility programmatically at 9.3 and 9.3 SP1 on a ForceElementLayer, implement the code given below.


The cause is due to an API change.

Solution or Workaround

Implement the following code:

// Example (C#) : Turn on all labels off a ForceElementLayer CoClass named “MoleForceElementLayer”
// Changed at 9.3

IEnumAttributeLabel pEnumLabel = MoleForceElementLayer as IEnumAttributeLabel;
for (int i = 0; i < pEnumLabel.Count; i++)
IAttributeLabel pAttrib = pEnumLabel.NextLabel();
pAttrib.IsVisible = true;

((ICachedGraphicLayer) MoleForceElementLayer).Refresh();

    Article ID:000010084

    • Legacy Products

    Get help from ArcGIS experts

    Contact technical support

    Download the Esri Support App

    Go to download options

    Related Information

    Discover more on this topic