Skybound Rebar

Rebar.RebarBandCollection.Add Method 

Adds an instance of type RebarBand to the end of this instance.

[Visual Basic]
Public Function Add( _
   ByVal value As RebarBand _
) As Integer
[C#]
public int Add(
   RebarBand value
);

Parameters

value
The RebarBand to be added to the end of this instance.

Return Value

The zero-based index value of the RebarBand added to the collection.

Remarks

You can also add new RebarBand objects to the collection by using the Insert method.

To remove a RebarBand that you have previously added, use the Remove or RemoveAt methods.

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