ESRI.ArcGIS.ADF.IMS
Remove Method
See Also  Example
ESRI.ArcGIS.ADF.IMS.Display.Renderer Namespace > LabelValueCollection Class : Remove Method




val
The LabelValue to be removed.
Removes a given LabelValue from the collection.

Syntax

Visual Basic (Declaration) 
Public Sub Remove( _
   ByVal val As LabelValue _
) 
Visual Basic (Usage)Copy Code
Dim instance As LabelValueCollection
Dim val As LabelValue
 
instance.Remove(val)
C# 
public void Remove( 
   LabelValue val
)

Parameters

val
The LabelValue to be removed.

Example

The following example removes the smallest cities from a renderer via the ValueMapLabelRenderer's collection. It first drills down into the layer (which has a GroupRenderer) to find the LabelValueCollection. Then it iterates through the values, finding the value range based on the minimum value. If found, the value is removed from the renderer.
Visual BasicCopy Code
' Access the values collection of a value map label renderer

Dim layer As FeatureLayer = mapView.Layers.FindByName("Cities")

Dim grpRend As GroupRenderer = layer.Renderer

Dim valueMapLabelRend As ValueMapLabelRenderer = grpRend.Renderers(0)

Dim valueColl As LabelValueCollection = valueMapLabelRend.Values



Dim valueToRemove As LabelValue = Nothing



'Find the value range to remove

For Each value As LabelValueRange In valueColl

    If value.MinValue = "-99" Then

        valueToRemove = value

        Exit For

    End If

Next



' If found, remove the value range

If Not IsNothing(valueToRemove) Then

    valueColl.Remove(valueToRemove)

End If

C#Copy Code
// Access the values collection of a value map label renderer 

FeatureLayer layer  = mapView.Layers.FindByName("Cities"); 

GroupRenderer grpRend = layer.Renderer; 

ValueMapLabelRenderer valueMapLabelRend  = grpRend.Renderers(0); 

LabelValueCollection valueColl = valueMapLabelRend.Values; 

  

LabelValue valueToRemove = null; 

  

// Find the value range to remove 

foreach (LabelValueRange value in valueColl) 



    if (value.MinValue == "-99") { 

        valueToRemove = value; 

        break; 

    } 



  

// If found, remove the value range 

if (valueToRemove != null) 

    valueColl.Remove(valueToRemove); 

    

Remarks

The input parameter must be a valid reference to an existing Value object in the collection, either a LabelValueRange or a UniqueLabelValue object.

See Also

© 2010 All Rights Reserved.