Version

Remove(String) Method

Removes the band with the specified key from the collection.
Syntax
'Declaration
 
Public Overloads Sub Remove( _
   ByVal bandKey As String _
) 
public void Remove( 
   string bandKey
)

Parameters

bandKey
The key of the band to remove.
Example
Following code demonstrates how to define hierarchical data structure in an UltraDataSource. Code in Button1_Click adds two child bands to the root bands and two columns to each of root band and its two child bands. Code in Button2_Click removes columns from the child bands and the child bands themselves. It demonstrates various methods for adding and removing bands and columns.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinDataSource
Imports Infragistics.Win.UltraWinGrid


    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
        ' Clear method removes all the bands from the child bands collection.
        Me.UltraDataSource1.Band.ChildBands.Clear()

        ' You can add child bands using Insert or add methods.
        Me.UltraDataSource1.Band.ChildBands.Insert(0, "ChildBand0")
        Me.UltraDataSource1.Band.ChildBands.Insert(1, "ChildBand1")

        ' You can get the child band using the child band key or an integer index.
        '
        Dim childBand0 As UltraDataBand = Me.UltraDataSource1.Band.ChildBands("ChildBand0")

        ' Add two columns to the child band 0.
        childBand0.Columns.Insert(0, "Col0", GetType(String))
        childBand0.Columns.Insert(1, "Col1", GetType(DateTime))

        ' This time get the child band using an integer index.			
        Dim childBand1 As UltraDataBand = Me.UltraDataSource1.Band.ChildBands(1)

        ' Add two columns to the child band.
        childBand1.Columns.Insert(0, "Col0", GetType(Integer))
        childBand1.Columns.Insert(1, "Col1", GetType(Double))
    End Sub

    Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim childBand0 As UltraDataBand = Me.UltraDataSource1.Band.ChildBands(0)
        Dim childBand1 As UltraDataBand = Me.UltraDataSource1.Band.ChildBands(1)

        ' You can remove a column by either specifying a column key or an index.
        childBand0.Columns.Remove("Col0")
        childBand1.Columns.RemoveAt(0)

        ' The same goes for the child bands.
        Me.UltraDataSource1.Band.ChildBands.Remove("ChildBand0")
        Me.UltraDataSource1.Band.ChildBands.RemoveAt(0)
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinDataSource;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;


		private void button1_Click(object sender, System.EventArgs e)
		{
			// Clear method removes all the bands from the child bands collection.
			this.ultraDataSource1.Band.ChildBands.Clear( );

			// You can add child bands using Insert or add methods.
			this.ultraDataSource1.Band.ChildBands.Insert( 0, "ChildBand0" );
			this.ultraDataSource1.Band.ChildBands.Insert( 1, "ChildBand1" );

			// You can get the child band using the child band key or an integer index.
			//
			UltraDataBand childBand0 = this.ultraDataSource1.Band.ChildBands[ "ChildBand0" ];

			// Add two columns to the child band 0.
			childBand0.Columns.Insert( 0, "Col0", typeof( string ) );
			childBand0.Columns.Insert( 1, "Col1",  typeof( DateTime ) );

			// This time get the child band using an integer index.			
			UltraDataBand childBand1 = this.ultraDataSource1.Band.ChildBands[ 1 ];

			// Add two columns to the child band.
			childBand1.Columns.Insert( 0, "Col0", typeof( int ) );
			childBand1.Columns.Insert( 1, "Col1", typeof( double ) );
		}

		private void button2_Click(object sender, System.EventArgs e)
		{
			UltraDataBand childBand0 = this.ultraDataSource1.Band.ChildBands[0];
			UltraDataBand childBand1 = this.ultraDataSource1.Band.ChildBands[1];

			// You can remove a column by either specifying a column key or an index.
			childBand0.Columns.Remove( "Col0" );
			childBand1.Columns.RemoveAt( 0 );

			// The same goes for the child bands.
			this.ultraDataSource1.Band.ChildBands.Remove( "ChildBand0" );
			this.ultraDataSource1.Band.ChildBands.RemoveAt( 0 );
		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also