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.
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
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 ); } }
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