Returning of an array
Could anyone tell me how to return an array in a function.
I need to pass the data of a two dimensional array from a function to the main. Actually, in my program I am reading data from a text file and then putting it in an array. This array with the data, has to be returned to the main function. Can anyone tell me a solution for this.
For example if the code is :
for i= 0 to 3
do while not eof(1)
Line Input #1, values
data(i,0) = getfield(values,1,",")
data(i,1) = getfield(values,2,",")
data(i,2) = getfield(values,3,",")
evaluate=data----> I would like to return this whole array and this causes the problem..
So can anyone help me in solving this problem.
[ 02-09-2005, 06:50 AM: Message edited by: softgoogle ]
Re: Returning of an array
Use byRef arguments to return arrays
</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">sub sub1(byRef arg() as string)
'here fill the "arg" array with values
'use "redim preserve" to change its' size
end sub</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">Now just call sub1 and pass an empty array as an argument.