DataGridViewCell::ColumnIndex Property
.NET Framework (current version)
Gets the column index for this cell.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Property Value
Type: System::Int32The index of the column that contains the cell; -1 if the cell is not contained within a column.
The column index for the row that contains the row headers has a value of -1.
The following code example demonstrates how to use the ColumnIndex property to determine which columns to check for integer values. In this example, the cells in the Description column are ignored when the contents of the selected cells are summed. This example is part of a larger example available in the DataGridView::SelectionChanged event.
.NET Framework
Available since 2.0
Available since 2.0
Show: