I have an UltraGrid bound to a UltraDataSource. I am trying to delete rows from the grid, but when I do so I get the error message box
"Unable to delete row. Specified method is not supported"
The caption on the message box is "Data Error", so I suspect the error might be in the DataSource.
What's the problem? Do I need to delete the row in the DataSource rather than in the grid? Shouldn't it work from the grid.
Here is my code:
For Each row As UltraGridRow In ugItemsToPick.Rows With row If condition Then row.Delete(False) ' Don't display confirmation box. End If End With Next
Both ideas did not work.
Here's my new code:
With ugItemsToPick For RowCnt As Int16 = .Rows.Count - 1 To 0 Step -1 If condition Then .Rows(RowCnt).Selected = True .DeleteSelectedRows(False) ' Don't display confirmation box. End If NextEnd With
P.S. I'll be out next week, so don't expect a quick reply
Hello sch,
Could you please provide a small sample project reproducing this issue if our suggestions did not help you. I will be happy to assist you further on that matter.
Hi,
You don't really need to mix the two approaches. What you have here is kind've inefficent, so I recommend sticking with one approach or the other. They are both equally valid. The down side of the Approach Boris proposed is that you will lose any existing selection in the grid, but that may not matter to you.
Anyway, if you are still getting an error, my guess is that this was not the problem, anyway. That error message is not familiar to me, but I have two guesses as to what might be causing it:
1) Your UltraDataSource is set not to allow deletions.
2) This exception is not coming from the UltraDataSet, but from somewhere else in your code.
If none of this helps, and you are still stuck, posting a small sample project which demonstrates the exception would allow us to see exactly what's wrong.
If you cannot do that, then try putting breakpoints in the grid's Error and/or CellDataError events and post the call stack. That might give us a clue as to where the error is coming from.