Skybound Rebar

Rebar.RebarBandCollection.Insert Method 

Inserts a RebarBand into this instance at the specified index.

[Visual Basic]
Public Sub Insert( _
   ByVal index As Integer, _
   ByVal value As RebarBand _
)
[C#]
public void Insert(
   int index,
   RebarBand value
);

Parameters

index
The index at which the RebarBand is inserted.
value
The RebarBand to insert.

Remarks

Since the order of bands on the screen may not match the order of the bands in this collection, a new band inserted into this collection will always be physically positioned after the last band on the bottom row.

You can also add new RebarBand objects to the collection by using the Add 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