Using VB.Net
I want to copy the last row value to new row
Code
Dim rcount As Int32
For i As Integer = 0 To gridview1.RowCount - 1
gridview1.Rows.Add()
rcount = gridview1.RowCount() - 1
For j As Integer = 0 To gridview1.Rows(i).Cells.Count - 1
gridview1.Rows(rcount).Cells(j).Value = gridview1.Rows(i).Cells(j).Value
Next
gridview1.Rows(rcount).Cells(1).Value = rcount + 1
rcount = 0
Next
The above code is working, but it is copying all the previous row to new row, i want to copy the last row to new
How to solve this problem.
Need VB.Net Code Help
If you only want to copy the last row to the new row then do this.
This will not work if you have a blank editable row always present. Then you need to subtract 2 from the “Dim LastRow” line.