|
-
May 25th, 2004, 11:58 PM
#1
Sub being called twice [Resolved]
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?
Last edited by mendhak; May 26th, 2004 at 03:35 AM.
-
May 26th, 2004, 03:33 AM
#2
Hyperactive Member
I think that since you already have a sub to handle the Click event of the buttons, namely "Private Sub Navigation" then you need not have AddHandler in your form load, its either one or the other.
-
May 26th, 2004, 03:34 AM
#3
D'oh!!
You're right. I don't need to include that "handles whatever.click" part.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|