-
how to declare an array as a function parameter in VB function definition?
I want to caculate a value from a sery of numbers,the simpliest way is transfer an array to the algorithm function ,isn't it?
How to manage this?
Thanks!
-
There are several ways to transfer arrays as parameters:
a)
As an array
Code:
Call a(yourarray())
Function a(YourArray())
b)
As an variant
Code:
call b(yourarray())
Function b(YourVariant)
c)
As an array of parameters
Code:
call b(a,b,c,d)
Function b(Paramarray YourArray())
-
I need another Post, so:
A few details about ParamArray:
ParamArray must be at the end of a parameter list
ParamArray must be a variant
ParamArray cannot be optional
eg:
Code:
Function Sum(ParamArray args() As Variant) As Double
Dim i As Integer
For i = 0 To UBound(args)
Sum = Sum + args(i)
Next:
End Function
Finally 211 posts. Oh, and I hope it helped. A bit.
Please?