vb.netwinformsinfragisticsultrawingrid

How to tell if a UltragridRow is added (new) or just modified?


I have an Infragistics Ultragrid on a winform. How can I tell if a row is added or just modified? The DataChanged property will just tell me if Data has changed, not if it was added (so I can put the row data in an SQL Insert statment) or if it was modified (so I can put it in an UPDATE sql statement.)

For Each row As UltraGridRow In GroupMetadataGrid.Rows
   If row.DataChanged Then
       Debug.WriteLine("Saving Changed Row")
   End If
Next

Thanks in advance.


Solution

  • UltraGrid does not track if the row has changed or was added. Look at the answer from Mike Saltzman in this thread in their forum.

    This is his answer:

    The grid does not track this. If you edit a row in the grid and move to another row, all changes in the previous row are committed to the data source. The grid doesn't deal with the data base directly, it only deals with it's local data source. So if you are looking to track changes in the data source that need to be written to the database, then the data source needs to take care of that. The DataSet and DataTable class have built-in support for tracking pending changes. The only thing you might have to be concerned about with the grid is that the current ActiveRow in the grid may have pending changes that need to be written to it's DataSource. For this you can use DataChanged. The grid will automatically commit changes when it loses focus, but if you need to manually force the changes to be committed, you can use the grid.UpdateData method, or the Update method on any individual row.