Skip to content

DefaultValuesNeeded Event in DGV #255

Description

@itg-assistant

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.


Metadata

Metadata

Assignees

No one assigned

    Labels

    GeneralQuestions, how-tos and everything else.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions