Skybound Rebar

Rebar.RebarBandCollection.Contains Method 

Determines whether a specfic RebarBand value exists in this instance.

[Visual Basic]
Public Function Contains( _
   ByVal value As RebarBand _
) As Boolean
[C#]
public bool Contains(
   RebarBand value
);

Parameters

value
The RebarBand value to locate.

Return Value

true if value exists in this instance; otherwise, false.

Remarks

This method enables you to determine whether a RebarBand is member of the collection before attempting to perform operations on the RebarBand. You can use this method to confirm that a RebarBand has been added to or is still a member of the collection.

Example

This example removes an existing RebarBand from a Rebar control if it exists and adds and inserts three new RebarBand object to the Rebar.

private void UpdateRebarBands(Skybound.Rebar.Rebar rebar, Skybound.Rebar.RebarBand toRemove)
{
    // if toRemove is in in the collection, remove it:
    if(rebar.Bands.Contains(toRemove))
    {
        rebar.Bands.Remove(toRemove);
    }
    
    // create three new rebar bands:
    RebarBand bandMenu = new RebarBand(RebarBandType.MenuBar);
    RebarBand bandTools = new RebarBand(RebarBandType.ToolBar);
    RebarBand bandAddress = new RebarBand(RebarBandType.ToolBar, "Address", null);
    
    // add the first two bands to the rebar:
    rebar.Bands.Add(bandMenu);
    rebar.Bands.Add(bandTools);
    
    // insert the third band before the first.  Note that although the index of this band
    // in the collection will be zero, it will still be physically ordered after the previous
    // two bands on the screen
    rebar.Bands.Insert(0, bandAddress);
}
            

See Also

Rebar.RebarBandCollection Class | Skybound.Rebar Namespace