Column name not found

  • Thread starter Thread starter RichardDunneBSc
  • Start date Start date
R

RichardDunneBSc

Guest
I want to format cell font color based on cell value in a RowAdded event. I am adding values from an Sql Server, the column headers are the table columns names.

int rowIndex = e.RowIndex;
if(Convert.ToDateTime(DataGridView.Rows[rowIndex].Cells["ColumnName"].Value) < DateTime.Today)

When I run the application I get


System.ArgumentException: 'Column named ColumnName cannot be found.
Parameter name: columnName'


Any idea why its not recognizing the column name?

Continue reading...
 
Back
Top