ASP Hosting sale!
Double disk space and transfer for FREE!
Limited time offer! Act Now!

aspdev | articles | tutorials | forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Passing an entire array to a function

 
Post new topic   Reply to topic    ASPdev.org Forum Index -> ASP programming
View previous topic :: View next topic  
Author Message
twinkle



Joined: 31 Jan 2006
Posts: 79

PostPosted: Tue Jan 31, 2006 9:15 pm    Post subject: Passing an entire array to a function Reply with quote

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
View user's profile Send private message
raven



Joined: 31 Jan 2006
Posts: 41

PostPosted: Wed Feb 01, 2006 9:32 am    Post subject: Reply with quote

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
View user's profile Send private message
twinkle



Joined: 31 Jan 2006
Posts: 79

PostPosted: Thu Feb 02, 2006 4:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ASPdev.org Forum Index -> ASP programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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

SQL Tutorial