View previous topic :: View next topic |
Author |
Message |
twinkle
Joined: 31 Jan 2006 Posts: 79
|
Posted: Tue Jan 31, 2006 9:15 pm Post subject: Passing an entire array to a function |
|
|
I know this is very basic but can someone show me how to pass an entire array through to a function. When I try it I just end up with no data in the array, when the function is being executed. _________________ I shine |
|
Back to top |
|
|
raven
Joined: 31 Jan 2006 Posts: 41
|
Posted: Wed Feb 01, 2006 9:32 am Post subject: |
|
|
To call the function:
Dim arrArray(10) ' could be dimensioned differently - just an example
If Not GetFunction(arrArray) Then
' handle error
End If
where GetFunction returns a boolean as the value of the function itself - this acts as a pass/fail test on the function operating correctly and is a great structure for handling errors withtin functions
Then in the Function declaration
Function GetFunction (ByRef arrArray)
' do something
End Function
Using ByRef allows you to write to the array inside the function and have the values available back out at the calling script level. ByVal would give you a local copy inside the function, but changes made inside the function would only be available inside the function. _________________ Programmers do it in code |
|
Back to top |
|
|
twinkle
Joined: 31 Jan 2006 Posts: 79
|
Posted: Thu Feb 02, 2006 4:52 pm Post subject: |
|
|
Do I have to use the DIM statement or can I forgo using it?
I am still struggling to figure this out. If I can not get it to work today I will post the code. I am not at home right now, though, so do not have it in front of me. _________________ I shine |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|