Number of arguments does not match forward declaration: <subprogram name>

You declared a function or sub with a Declare statement, and then either of the following happened:

  • You defined the function or sub with a Function or Sub statement specifying a different number of parameters than you specified in the Declare statement. For example:
    Declare Function MyFunction(X As Integer, Y As Double) As Integer
    ' ...
    Function MyFunction(X As Integer) As Integer  ' Illegal because Declare
    ' ...                                         ' specified two parameters
    End Function

    Make the parameters in the declaration and definition match each other.

  • The procedure that you forward declared is a parameterized constructor sub (Sub New) inside a Class statement and you have not defined a Sub New for that class.

    Either remove the Declare statement or define a corresponding Sub New.