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




val
A reference to the Value item to remove from the renderer's value collection.
Removes a Value from the collection.

Syntax

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

Parameters

val
A reference to the Value item to remove from the renderer's value collection.

Example

The following example removes the smallest cities from a renderer via the ValueMapRenderer's collection. It first drills down into the layer (which has a GroupRenderer) to find the ValueCollection. 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 renderer

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

Dim grpRend As GroupRenderer = layer.Renderer

Dim valueMapRend As ValueMapRenderer = grpRend.Renderers(0)

Dim valueColl As ValueCollection = valueMapRend.Values



Dim valueToRemove As Value = Nothing



'Find the value range to remove

For Each value As ValueRange 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 renderer 

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

GroupRenderer grpRend = layer.Renderer; 

ValueMapRenderer valueMapRend  = grpRend.Renderers(0); 

ValueCollection valueColl = valueMapRend.Values; 

  

Value valueToRemove = null; 

  

// Find the value range to remove 

foreach (ValueRange 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 ValueRange or a UniqueValue object.

See Also

© 2010 All Rights Reserved.