Referencing Function Arguments

  • Thread starter Thread starter Brian Tkatch
  • Start date Start date
B

Brian Tkatch

Is there a way to reference an argument to a function without using its
name?

Something like:

Public Function MyFunc(ByVal Arg1 As String, ByVal Arg2 As String) As
String

MsgBox(MyFunc.Arguments(1).Value)
MsgBox(MyFunc.Arguments(2).Value)

End Function

B.
 
Hello Brian,

Yes.. but it's not good practice. You can declare a parameter as a ParamArray
(look it up in the help docs). But it would be best to just pass an array,
like:

public sub SomeFunction(byval tArray() as string)
Dim tIndex as integer=0

for tIndex=tArray.GetLowerBounds(0) To tArray.GetUpperBounds(0)
msgbox(tArray(tIndex)
next
end sub

-Boo
 
GhostInAK said:
Hello Brian,

Yes.. but it's not good practice. You can declare a parameter as a ParamArray
(look it up in the help docs). But it would be best to just pass an array,
like:

public sub SomeFunction(byval tArray() as string)
Dim tIndex as integer=0

for tIndex=tArray.GetLowerBounds(0) To tArray.GetUpperBounds(0)
msgbox(tArray(tIndex)
next
end sub

-Boo

Thanx,

Actually, i do not want to pass an array at all. It is important that
the definition of the function's arguments be exact.

B.
 
Hello Brian,

Then no. Having written the function you should know the parameters' names.


-Boo
 
Back
Top