Incorrect Number of Event Arguments

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!

See also  5 Ways to Improve Customer Experience

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist