Hi There
I am Using UltraWinGrid 9.2 bound to a data relation on the child side and UltraWinGrid.UpdateMode = OnRowChangeOrLostFocus.
When I am on a newly inserted row and I click Save on the Toolbar, I execute the following code
With ugrdProduction
.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.ExitEditMode) ' this line returns False for some reason
.Update()
End With
My problem is that the above code does not commit the new grid row to the grid rows collection.
After the above code, ugrdProduction.rows.count = 0
If I add successive new rows using the mouse, then all rows will be commited except the last row. The only way that I can commit the last row to the rows collection is to cause the grid to lose focus by clicking on another control on the Form
How can I programmatically commit the last row on the grid, being a newly inserted row and also being the current row, to the rows collection.
TIA
Problem solved.
The code following code is the correct way to programmatically commit the last row in the grid
With UltraWinGrid
.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.ExitEditMode)
In my situation, the above code was not working because after inserting the new row I performed some row edits on the actual datarow object itself of the underlying datatable. The act of editing the datarow object itself caused the UltraWinGrid to loose it’s reference to the active row, i.e. UltraWinGrid.ActiveRow = Nothing
So the moral of the story is to
1) Do ALL edits through the UltraWinGrid.ActiveRow.Cells(x) objects (best practice), or
2) Finish your edits in the UltraWinGrid.ActiveRow, then execute UltraWinGrid.PerformAction(UltraGridAction.ExitEditMode) and UltraWinGrid.Update() and then lastly do your edits on the datarow object itself.