DataGridViewCell::ColumnIndex Property

 

Gets the column index for this cell.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public:
property int ColumnIndex {
	int get();
}

Property Value

Type: System::Int32

The 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.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: