B
Bill Cart
I have a datagridview that was created by dragging an SQL stored procedure
onto the form. The SQL query has fields for Monday, Tuesday, etc.
I am trying to set some of the values with the DefaultValuesNeeded event.
When I right click on the control and select Edit Columns I can see a column
that appears to be named Monday.
The code is:
private void spApplicantMealListDataGridView_DefaultValuesNeeded(object
sender, DataGridViewRowEventArgs e)
{
e.Row.Cells[9].Value = ThisClientId;
e.Row.Cells["Monday"].Value = 0;
}
When I run the program I get an error: {"Column named Monday cannot be
found.\r\nParameter name: columnName"}
I go into Edit columns and Click on Add new column and select Monday as a
DataBound column. I add the column and then I see two columns that appear to
be named Monday. I run the program and then it works and shows the correct
data in both of the columns!! I can delete the original column and it works
correctly from then on.
Why? What are the default names for the columns?
onto the form. The SQL query has fields for Monday, Tuesday, etc.
I am trying to set some of the values with the DefaultValuesNeeded event.
When I right click on the control and select Edit Columns I can see a column
that appears to be named Monday.
The code is:
private void spApplicantMealListDataGridView_DefaultValuesNeeded(object
sender, DataGridViewRowEventArgs e)
{
e.Row.Cells[9].Value = ThisClientId;
e.Row.Cells["Monday"].Value = 0;
}
When I run the program I get an error: {"Column named Monday cannot be
found.\r\nParameter name: columnName"}
I go into Edit columns and Click on Add new column and select Monday as a
DataBound column. I add the column and then I see two columns that appear to
be named Monday. I run the program and then it works and shows the correct
data in both of the columns!! I can delete the original column and it works
correctly from then on.
Why? What are the default names for the columns?