I was creating a very simple db application, and noticed that when I was clicking the navigation buttons (Next, Previous, First, Last), the sub being used to handle it is being called twice.
I commented out all the code in the sub, and stepped through the code, and it was still being called twice.
Here's what I have:
VB Code:
'First, add the handlers Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AddHandler cmdPrevious.Click, AddressOf Navigation AddHandler cmdFirst.Click, AddressOf Navigation AddHandler cmdLast.Click, AddressOf Navigation AddHandler cmdNext.Click, AddressOf Navigation End Sub 'Then: Private Sub Navigation(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdFirst.Click, cmdLast.Click, cmdNext.Click, cmdPrevious.Click MessageBox.Show "Bing" End Sub
Why is it being called twice?![]()




Reply With Quote