I'm trying to select the last row in a DataGridView after adding a new item. For this I am executing the following code:
dgwVenda.ClearSelection()
dgwVenda.Rows(dgwVenda.Rows.Count - 1).Selected = True
If dgwVenda.Controls(1).Visible = True Then
dgwVenda.FirstDisplayedScrollingRowIndex = dgwVenda.Rows(dgwVenda.Rows.Count - 1).Index
End If
After execution the last line is selected and appearing in the Grid, however the scrollbar (vertical) is at the top when it should be at the bottom. Also scrolling the mouse does not work.
After the position of the bar is changed by a click of the mouse its operation returns to correct.
Is there any way for the scroll bar to stay in the down position and the scrolling work by scrolling the mouse?