
Originally Posted by
thek
Yes.
But there is
no code behind the BindingNavigatorMoveNextItem_Click, it looks like this:
Code:
Private Sub BindingNavigatorMoveNextItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorMoveNextItem.Click
End Sub
Where can I see the code that move one record forward? (When I create database access via the wizard)
To say John's post another way:
You can't see it, because Microsoft wrote the BindingNavigator. It takes in a BindingSource as a parameter, and then simply calls bindingSource.MoveNext every time you click on what it knows to be the Next button (you tell it that too)
Simply put, their code might look like this:
Code:
Class BindingNavigator
Private _bs as BindingSource
Property BindSource as BindingSource
Set
_bs = value
End Set
End Property
Private _mni as Button
Property MoveNextItem as Button
Set
_mni = value
AddHandler(_mni.Click, AddressOf(MNIClickHandler))
End Set
End Property
Private Sub MNIClickHandler
_bs.MoveNext()
End Sub
End Class
If you really wanna see the code then use Reflector to decompile the .NET framework, but it will be like this in essence:
When the MoveNextItem is set to a button, the click handler of that button is assigned INSIDE the bindingnavigator code to a handler that is ALSO inside the bindingnavigator code
Every time you click the button, it just calls MoveNext on the bindingsource the bindingnavigator is attached to (ALSO inside the bindingnavigator code)
If you want to "roll your own" MoveNext handler you HAVE to tell the BindingNavigator it has no set MoveNextItem
-> Open the properties for the BindingNavigator
Find the MoveNextItem setting
Set it to NONE
Now you can roll your own click handler in your own code
Bookmarks