Oops, you're right! I fixed my code above. Alternatively you could create a Sub that enables the buttons correctly...
And then just call that Sub after each "movement". For example:Code:Public Sub FixButtons() ' First make all of the buttons Enabled... btnToStart.Enabled = True btnPrevious.Enabled = True btnToEnd.Enabled = True btnNext.Enabled = True ' Now disable those buttons for the fringe cases... Dim index As Integer = Me.TblStudentsBindingSource.Position() If index = Me.TblStudentsBindingSource.Count - 1 Then btnToEnd.Enabled = False btnNext.Enabled = False ElseIf index = 0 Then btnToStart.Enabled = False btnPrevious.Enabled = False End If End Sub
Code:Private Sub btnToStart_Click(sender As Object, e As EventArgs) Handles btnToStart.Click Me.TblStudentsBindingSource.MoveFirst() 'Moves to the First Record FixButtons() End Sub




Reply With Quote
