Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Oct 1, 1996



How to Help Your Business Become an AI Early Adopter

Incorrect Number of Event Arguments

I am getting the error: INCORRECT NUMBER OF EVENT PROCEDURE ARGUMENTS. This has been occuring ever since I created a control array of command buttons. I have to complete my project by tomorrow. Please Help!

I would guess that somewhere you have code in a Click event for one of those buttons. The quickest way to resolve this problem is this:

  1. Cut the code for the command buttons
  2. Highlight the entire event procedure, including the declaration and the End Sub, and delete it.
  3. Select the Command button array in the object list, and select the Click event.
  4. You'll see that the parameters to the click now include the Index property, which was probably missing before.
  5. Paste in your code, making sure to remember that you have to check the index of the button to determine which button activated.
Also, the easiest way to keep track of which code goes to which button is to put all the various code in a Select Case statement. (e.g. Select Case Index). Comment heavily!
DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date