I want to programmatically delete the last row in my Datagridview when a user clicks a button. As of now, the program will scroll down and highlight the last row, but only deletes the row where the index is at. So, I need to move the indexer (triangle indicator) to the last row. How do I do this??
If LftMtr_Data_Grid.RowCount >= 2 Then
LftMtr_Data_Grid.FirstDisplayedScrollingRowIndex = LftMtr_Data_Grid.RowCount - 2 'scroll to the last row
LftMtr_Data_Grid.Rows(LftMtr_Data_Grid.RowCount - 2).Selected = True 'select the last row
LftMtr_Data_Grid.Rows.RemoveAt(LftMtr_Data_Grid.CurrentRow.Selected) 'delete selected row
End If
Thank you