ColIndex Property

       

Returns a value indicating the position of the column in the Columns collection of the DataGrid control and the visible position (left-to-right) of the column in the DataGrid control. This property is read-only at run time and not available at design time.

Syntax

object.ColIndex

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

Note that the value of the position given is the same as if all columns were visible and doesn't change if you hide one or more columns.

This property returns the zero-based index of a column within the Columns collection. Note, however, that For… Each is not guaranteed to return items in any particular order.