Sunday 22 September 2013

How to use extendable parameter list in functions using paramarray in Visual Basic 6.0

' This program will call a function which can take as many parameters as possible. Parameters not predefined.

option explicit

private sub PrintName(ParamArray arg() As Variant) ' argument is of type variant (can store any type of value) paramarray, function can be called with arguments which is flexible.

   dim i as integer
   for i=lbound(arg) to ubound(arg)
     ' lbound is the lower bound of the array and ubound is the upper bound of the array
       debug.print arg(i)
   next i
End Sub

No comments: