0

I have a function with an array inside:

Function newFunction()
  Dim newArray(1,1)
  newArray(0,0) = "1"
  newArray(1,0) = "2"
  newArray(0,1) = "3"
  newArray(1,1) = "4"
  newFunction = newArray
End Function

I want to be able to call this function on another page and write the results like this:

<%= newFunction(1,0) %>

and this should write out: 2

I keep getting the error "Wrong number of arguments or invalid property assignment" when I do this. How can this be done?

4 Answers 4

3

Looks like you should actually be doing:

<%= newFunction()(1,0) %>

But I'm no expert in VB.

Sign up to request clarification or add additional context in comments.

Comments

1

You need this instead:

<%= newFunction()(1, 0) %>

It thinks you're calling newFunction with arguments 1 and 0, not accessing its return value.

Comments

0

This is an issue with scope. Your "other page" cannot see, or doesn't have access to the definition of this function.

In order to do something like this, you need to include the file that has the definition of this function.

See: http://www.w3schools.com/asp/asp_incfiles.asp

Comments

0

Is there a reason why you want to do this in this manner? Why not just access the array itself on the second page?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.