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.
Not all objects in a collection support an Index property. For certain objects, the Index value is essentially meaningless except as an internal placeholder within the collection. In these cases, the object will not have an Index property, even though it is in a collection. You can use other mechanisms, such as the Key property or the For Each...
loop structure, to access the objects in the collection.
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Imports System.Diagnostics Private Sub Button32_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button32.Click ' Check if there is an active cell. If Not Me.ultraGrid1.ActiveCell Is Nothing Then ' Print out the the column key and the row index of the active cell. Debug.WriteLine("ActiveCell's column = " & Me.ultraGrid1.ActiveCell.Column.Key & ", Row Index = " & Me.ultraGrid1.ActiveCell.Row.Index.ToString()) Else Debug.WriteLine("There is no active cell.") End If End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void button32_Click(object sender, System.EventArgs e) { // Check if there is an active cell. if ( this.ultraGrid1.ActiveCell != null ) { // Print out the the column key and the row index of the active cell. Debug.WriteLine( "ActiveCell's column = " + this.ultraGrid1.ActiveCell.Column.Key + ", Row Index = " + this.ultraGrid1.ActiveCell.Row.Index.ToString( ) ); } else { Debug.WriteLine( "There is no active cell." ); } }
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