Indeks kolumny DataGridView

// To retrieve a DataGridView column by name you simply reference it through the columns 
// collection indexer:
datagridview1.Columns["columnName"]

// Then you can get the column index from that column:
datagridview1.Columns["columnName"].Index;

// Do note that if you use an invalid column name then this reference will return null, 
// so you may want to check that the column reference is not null before using it, 
// or use the columns collection .Contains() method first.
Mappy Show