1
I am trying to select the last line in a Datagridview after including a new item. For this I am running 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 the execution the last line is selected and appearing in the Grid, but the scroll bar (vertical) is at the top, when it should be at the bottom. Also the mouse scrolling (by scroll) does not work.
After the position of the bar is changed by a mouse click its function is back to being correct.
Is there any way for the scroll bar to be in the lower position and the scrolling to work by the mouse scroll?