Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


return array?

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,53330
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> return array?
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 return array? - 11/7/2007 12:08:54 AM   
  acki4711

 

Posts: 2
Score: 0
Joined: 11/7/2007
Status: offline
Hi all,
Is it possible to return an array from a function call ?
I always get "Type missmatch" with the following example:

Dim arr()
arr = F1()
...

Function F1()
Dim astrGrpMbr(10)
Dim iCnt 
iCnt = 0
While iCnt < 10
     astrGrpMbr(iCnt) = CStr(iCnt) & " * " & CStr(iCnt) & " = " & CStr(iCnt * iCnt)
     WScript.Echo (astrGrpMbr(iCnt))
     iCnt = iCnt + 1
Wend
F1 = astrGrpMbr

End Function
 
 
Post #: 1
 
 RE: return array? - 11/7/2007 2:09:32 AM   
  dm_4ever


Posts: 2663
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
Dim arr
arr = F1()

WScript.Echo UBound(arr)

Function F1()
   Dim astrGrpMbr(10)
   Dim iCnt
   iCnt = 0
   While iCnt < 10
       astrGrpMbr(iCnt) = CStr(iCnt) & " * " & CStr(iCnt) & " = " & CStr(iCnt * iCnt)
       WScript.Echo (astrGrpMbr(iCnt))
       iCnt = iCnt + 1
   Wend
   F1 = astrGrpMbr
End Function

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to acki4711)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> return array? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts