AppStudio Version 8.4.2.0.
I have a common Grid on my form.
I need to delete a single row that’s picked.
How do I delete a single grid row?
Thanks.
There’s no easy way to do this.
You’ll need to deleteRows()
from the bottom of the table to the one you want to get rid of, then addRows()
to put back the ones you want to keep.
Function GeneralGridDelRow(gridobj,gridrow)
gridElement=NSB.$(gridobj)
If gridrow<0 Or gridrow>gridElement.getRowCount() - 1 Then Exit Function
If gridElement.getRowCount() - 1=0 Then
GeneralGridClear(gridobj,"")
Else
For currow=CInt(gridrow) + 1 To gridElement.getRowCount() - 1
For gridcol=0 To gridElement.getColCount() - 1
gridElement.setValue(currow - 1,gridcol,gridElement.getValue(currow,gridcol))
Next
Next
gridElement.deleteRows(1)
End If
End Function
this is what i did, ie
GeneralGridDelRow “grid1”,“2”
ps: this function has a “bug” for not copy the value of item if you have a html item into the cell
teo
Thanks for the code.
Once I figured out what was going on, and how it was working, I was able to put parts of it into my own code. It worked very well.
Yours is a very smart method.
I think that whoever wrote the Grid functions needs to put in a way to delete a row from inside the rows and not just from the end.
Thanks again, very helpful.