EtherealSky

Hi, the topic might sounds confusing but anyway, I'll explain in details with an example

Says I have a function call "totalVal" which accomulates all the values inside a matrix according to the dimension values of x and y.

---------------------
Public Function totalVal ( byval Arr_x# ( , ), byval x%, byval y%) as double
Dim Val as double, i , j as integer
Val = 0
for i = 0 to x
for j = 0 to y
Val = Val + Arr_x(i, j)
next j
next i
Return Val
End function
---------------------

Calling the function in some other code.
---------------------
Val = totalVal ( ArrayX (, ), 4 , 4)
---------------------

For some reason VB doesn't allow me to input an implicited array like ArrayX(, ) into the function. Does anyone know how to get this to work.

### Re: Visual Basic Language Calling Arrays into Function/Subroutine calculations

Frank Carr

You don't need to specify the dimensions of the array when you call it. Your call should look like this:

Val = totalVal ( ArrayX , 4 , 4)

This assumes that ArrayX has been properly intialized before the call.

### Re: Visual Basic Language Calling Arrays into Function/Subroutine calculations

EtherealSky

What about the function Do I need to chnage the dimension specification from "byVal Arr_x# (, )" to just "byVal Arr_x#"

Dick Donny

Yes

### Re: Visual Basic Language Calling Arrays into Function/Subroutine calculations

Frank Carr

You will need to specify the number of dimensions the array has in your function declaration. Otherwise, you'll get an error.

### Re: Visual Basic Language Calling Arrays into Function/Subroutine calculations

EtherealSky

Ok, I knew roughly how this works now. Thx you guys for helping.