locked
Datagridview not adding row to bound datatable RRS feed

  • Question

  • I have a datagridview bound to a datatable in a dataset (no BindingSource object is used). I use the datagridview.leave event to process the user changes to the datagridview. I use the following code in the event:

    Dim dsChange As DataSet = CType(dgvModifyTableNames.DataSource, DataSet)

    Dim dtChangesAdded As DataTable = dsChange.Tables("Table_Names").GetChanges(DataRowState.Added)

    If the user adds a row, filling all the required columns, and then leaves the datagridview  dtChangesAdded is nothing.  However, if the user changes the currentrow and then leaves, dtChangesAdded contains the added row.  How do I get the added row to be returned if the user leaves it as the currentrow?

    Monday, December 18, 2006 5:14 PM