Cris asked 2016-09-14 16:40:06 UTC
Hi,
I am adding columns to DGV thru code with AllowUserToAddRows = true. In WinForm and Wisej, when the first column is added, it triggers RowAdded event immediately. In Winform, it will continue to add all other columns to the DGV and fires the DefaultValuesNeeded when the NewRow is clicked or entered. But in Wisej, right after adding the first column, it subsequently fires DefaultValuesNeeded right away causing a "Column named Column2 cannot be found" error.
I am using DefaultValuesNeeded to initialize the NewRow with default values. If I want to initialize this row with:
e.Row.Cells["Column1"].Value = "Washington"; //Column1 is already in the DGV
e.Row.Cells["Column2"].Value = "DC";
the second line will fail because Column2 has not been added yet when DefaultValuesNeeded is executed.
Am I missing something? Any workaround for this?
Thanks.
Cris asked 2016-09-14 16:40:06 UTC
Hi,
I am adding columns to DGV thru code with AllowUserToAddRows = true. In WinForm and Wisej, when the first column is added, it triggers RowAdded event immediately. In Winform, it will continue to add all other columns to the DGV and fires the DefaultValuesNeeded when the NewRow is clicked or entered. But in Wisej, right after adding the first column, it subsequently fires DefaultValuesNeeded right away causing a "Column named Column2 cannot be found" error.
I am using DefaultValuesNeeded to initialize the NewRow with default values. If I want to initialize this row with:
e.Row.Cells["Column1"].Value = "Washington"; //Column1 is already in the DGV
e.Row.Cells["Column2"].Value = "DC";
the second line will fail because Column2 has not been added yet when DefaultValuesNeeded is executed.
Am I missing something? Any workaround for this?
Thanks.