Infragistics(R) NetAdvantage(R) Windows Forms
Index Property
See Also  Example E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace > UltraGridColumn Class : Index Property

The index of this column in the band's column collection

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property Index As Integer
C# 
public int Index {get;}

Example

Following code loops throgh all the columns and prints out thier indexes and keys.

Visual BasicCopy Code
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Imports System.Diagnostics

   Private Sub Button94_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button94.Click

       Dim columns As ColumnsCollection = Me.ultraGrid1.DisplayLayout.Bands(0).Columns

       ' Loop through all the columns.
       Dim i As Integer
       For i = 0 To columns.Count - 1
           Dim column As UltraGridColumn = columns(i)

           ' Write out the index and the key of the column.
           Debug.WriteLine("columns(" & i & ").Index = " & column.Index & ", Key = " & column.Key)
       Next

   End Sub
C#Copy Code
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void button94_Click(object sender, System.EventArgs e)
{

	ColumnsCollection columns = this.ultraGrid1.DisplayLayout.Bands[0].Columns;

	// Loop through all the columns.
	for ( int i = 0; i < columns.Count; i++ )
	{
		UltraGridColumn column = columns[i];

		// Write out the index and the key of the column.
		Debug.WriteLine( "columns[" + i + "].Index = " + column.Index + ", Key = " + column.Key );
	}

}

Remarks

The Index property is set by default to the order of the creation of objects in a collection. The index for the first object in a collection will always be zero.

The value of the Index property of an object can change when objects in the collection are reordered, such as when objects are added to or deleted from the collection. Since the Index property may change dynamically, it may be more useful to refer to objects in a collection by using its Key property.

See Also