Results 1 to 3 of 3

Thread: Sub being called twice [Resolved]

Threaded View

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Red face 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:
    1. 'First, add the handlers
    2. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    3.         AddHandler cmdPrevious.Click, AddressOf Navigation
    4.         AddHandler cmdFirst.Click, AddressOf Navigation
    5.         AddHandler cmdLast.Click, AddressOf Navigation
    6.         AddHandler cmdNext.Click, AddressOf Navigation
    7.  
    8.        
    9.     End Sub
    10.  
    11. 'Then:
    12.  
    13.     Private Sub Navigation(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdFirst.Click, cmdLast.Click, cmdNext.Click, cmdPrevious.Click
    14.  
    15. MessageBox.Show "Bing"
    16.  
    17.     End Sub

    Why is it being called twice?
    Last edited by mendhak; May 26th, 2004 at 03:35 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width