0

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
2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by eladreznik
0

hi eladreznik

I think maybe index should be CurrentRow.Index + 1 irrespective of e.delta. This line is causing the problem:

index = grdAccountTypes.CurrentRow.Index + 1 + 1
0

iunderstand that however if i will not assign that value to index then the first row index would be 0 and not 1 and it's kind of confusing

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.