vb.netdatatabledatasetinfragisticsrowstate

Set RowState of a DataTable row to deleted


I have an UltraGrid in my project, and I have an update function on the form to update the data in the database where the data is matching.

The data in the grid is being stored as a DataTable. If a row of existing data is deleted from the UltraGrid, I want to be able to set the RowState of that row in the DataTable to 'RowState.Deleted, so that in the Update function I can check theRowState`, and if it's a deleted row, then deleted it, otherwise, update the data.

How can I go about doing this? So far, I have the code below, but the count of rows being returned is 1 (or, the current number of rows in the grid) and not 2 (the number there was before I deleted one row).

How and where in the code, do I set the RowState of the deleted row to be RowState.Deleted? Is there an alternative way of doing it using the UltraGrid?

dsProducts.Tables.Add(commDt.Copy) -- commDt is the DataTable linked to the UltraGrid
tr = con.BeginTransaction(

  For Each dr As DataRow In dsProducts.Tables(0).Rows
    If dr.RowState = DataRowState.Deleted Then
     Try

Solution

  • Solved it.