Search code examples
vb.netdatagridviewdatagridviewrow

Vb.net Move A Datagridview Row to the last row when being edited


I haven't found exactly what i need in the forums. I don't want to move selection or scroll index, all what I need to is to change the entire row with a specific index to be the last line in my datagridview. I need this to happen automatically when i edit this row.

P.S. Datagrid is Unbound

for example:

dgv.rows(index).index=dgv.row.getlastrow

However, the debugger return an error that index is read only.

Please help guys!


Solution

  • This worked for me:

    Dim curr_row As DataGridViewRow = idgv.Rows(Index)               
    Dim curr_index As Integer=idgv.Rows.GetLastRow(DataGridViewElementStates.Visible)     
    idgv.Rows.Remove(curr_row)
    idgv.Rows.Insert(curr_index, curr_row)