issue has to do with the number of rows which I represent
The first row in the dB is 0, so to prevent confusions I added 1 to the index so row 0 will be represented as row 1. The issue is that when I scroll down I “gain” a row, and the last row will be presented as row 23, though I actually have only 22 records.
Public Sub grdMouseWheel(ByVal sender As Object, ByVal e As MouseEventArgs)
Try
If e.Delta > 0 Then
Dim index As Integer
index = grdAccountTypes.CurrentRow.Index + 1
grdAccountTypes.DataSource.moveprevious()
grdAccountTypes.Select()
lblCRM.Text = index.ToString
ElseIf (e.Delta < 0) Then
Dim index As Integer
index = grdAccountTypes.CurrentRow.Index + 1 + 1
grdAccountTypes.Select()
grdAccountTypes.DataSource.MoveNext()
lblCRM.Text = index.ToString
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub