Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Arrays as parameters to functions

Status
Not open for further replies.

mprogram

Programmer
Apr 27, 2004
2
US
I need to pass an array as a parameter to a function. What is the proper syntax? I have tried everything, but when I compile it says that there is an error with the argument list.
 
This works for me.

Function MyTest (asData()) as integer
If AsData(1) = 1 then
MyTest = 1
ElseIf asData(2) = 1 then
MyTest = 2
End If
End Function

Sub Main()
Dim asData(2)
asData(2) = 1
testme = MyTest(asData )
End Sub


Be sure you're dimming the variable before you try to send it to the function.

calculus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top