Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Array element addition without an index reference?

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Array element addition without an index reference?
  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 >>
 Array element addition without an index reference? - 10/22/2006 12:35:25 PM   
  thepip3r

 

Posts: 16
Score: 0
Joined: 10/21/2006
Status: offline
some languages just allow you to perform like an array push where they just reference the array and it dumps the value at the bottom of the array with an incremented index 1 greater than the ubound of the standing array.  so basically, is there a way in vbscript to just add an element to an array WITHOUT delcaring the index number in the code?
 
 
Post #: 1
 
 RE: Array element addition without an index reference? - 10/22/2006 3:52:56 PM   
  TNO


Posts: 1247
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
A push() mehod IS possible but  don't think you'd like it. You have to build a complex class (60-70 lines of code) to make it efficient.....

So to avoid putting yourself through the horror of it, use the dictionary object:


      

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to thepip3r)
 
 
Post #: 2
 
 RE: Array element addition without an index reference? - 10/22/2006 8:05:57 PM   
  ehvbs

 

Posts: 2169
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi thepip3r,

  (1) have a look at the topic "Help with arrays and functions".

  (2) consider using one of the .NET collections ("System.Collections.ArrayList", "System.Collections.SortedList")

  (3) very simple Push:


      

(in reply to TNO)
 
 
Post #: 3
 
 RE: Array element addition without an index reference? - 10/23/2006 9:15:53 AM   
  thepip3r

 

Posts: 16
Score: 0
Joined: 10/21/2006
Status: offline
ehvbs: I just wanted to know if there was an inherent way in VBScript to accomplish this; apparently not.  Also, that suggestion wasn't very helpful.  If you wanted me to search for that string on the forum, it wasn't very helpful.  I ended up finding some other code references on the net and slightly modified the code to produce a function to do what I was looking for.  Thank you for helping gents.


      

(in reply to ehvbs)
 
 
Post #: 4
 
 
 
  

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 >> Array element addition without an index reference? 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