Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

datagridview column index

// 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.
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #datagridview #column #index
ADD COMMENT
Topic
Name
1+3 =