Link to home
Start Free TrialLog in
Avatar of sandra1628
sandra1628

asked on

Customized BindingNavigatorMoveNextItem.Click in vb .net

I want to check some conditions when user clicking the 'move next' button from the Binding Navigator.

My problem is when I retreive the current binding source item, it is the previous record,  I would like to get the record that are going to display on the form when the "move next" button is clicking.

Here is my code:

Private Sub BindingNavigatorMoveNextItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorMoveNextItem.Click

        Dim currentRow As DataRowView = Me.MyBindingSource.Current

        Dim dateValue As Date = currentRow.Item("Date")

        MsgBox("Move next - date is " + dateValue)

        MsgBox("Move next - Current binding position is " + MyBindingSource.Position.ToString)
   
        MsgBox("Move next - Is date null? " + IsDBNull(dateValue).ToString)

        If IsDBNull(dateValue) Then
           
            Me.DateDateTimePicker.Value = Date.Now
            Me.DateDateTimePicker.Checked = False

        Else
            Me.DateDateTimePicker.Value = dateValue
            Me.DateDateTimePicker.Checked = True
        End If

    End Sub

When running the code, when I clicks the 'move next' button from the binding navigator bar, the current binding date and the current binding position is from the first record.  

How can I get the data for 2nd record instead?
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sandra1628
sandra1628

ASKER

It works great!  Thanks a lot !
it works great, thanks