The Navigation Procedure

Next let’s fill in the code for the NavButtons event procedure. The code appears as follows:

 Private Sub NavButtons(ByVal sender As Object, ByVal e As EventArgs) Dim intNewRow As Integer Try Me.ParentForm.BindingContext(mDataSet, _ mintBoundTable).EndCurrentEdit() intNewRow = Me.ParentForm.BindingContext(Me).Position Select Case CType(sender, Button).Name Case "cmdFirst" intNewRow = 0 Case "cmdPrevious" If intNewRow > 1 Then itNewRow -= 1 Else intNewRow = 0 End If Case "cmdNext" If intNewRow < _ mDataSet.Tables(mintBoundTable).Rows.Count - 1 Then intNewRow += 1 Else intNewRow = _ mDataSet.Tables(mintBoundTable).Rows.Count - 1 End If Case "cmdLast" intNewRow = mDataSet.Tables(mintBoundTable).Rows.Count - 1 End Select ...

Get ADO.NET Programming in Visual Basic™ .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.