Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Array String Number...

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Array String Number...
  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 String Number... - 5/9/2008 11:25:56 AM   
  semihcan

 

Posts: 2
Score: 0
Joined: 5/9/2008
Status: offline
here is my arrays :

a1=Array(1,2,3,4,5,6,7,8,9)
a2=Array(11,2,3,4,5,6,7,8,9)
a3=Array(111,2,3,4,5,6,7,8,9)
a4=Array(1111,2,3,4,5,6,7,8,9)
a5=Array(11111,2,3,4,5,6,7,8,9)

here is the loop

For i = 1 to 5
msgbox a&i&(0)
Next

i expected :
1
11
111
1111
11111

but gives error

how can i get the array values?
i can not tell the machine that

a&i&(0)  equals  a1(0) => 1
a&i&(0)  equals  a2(0) => 11
a&i&(0)  equals  a3(0) => 111
a&i&(0)  equals  a4(0) => 1111
a&i&(0)  equals  a5(0) => 11111


please help me!!!
 
 
Post #: 1
 
 RE: Array String Number... - 5/9/2008 1:44:05 PM   
  dm_4ever


Posts: 2433
Score: 38
Joined: 6/29/2006
From: Orange County, California
Status: offline

      

_____________________________

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 semihcan)
 
 
Post #: 2
 
 RE: Array String Number... - 5/9/2008 4:47:37 PM   
  semihcan

 

Posts: 2
Score: 0
Joined: 5/9/2008
Status: offline
dm_4ever
thank you for the code
it works very well

(in reply to dm_4ever)
 
 
Post #: 3
 
 RE: Array String Number... - 5/9/2008 9:18:45 PM   
  mcnd

 

Posts: 23
Score: 0
Joined: 4/27/2008
Status: offline
 why not

dim a

   a = Array( Array(1,2,3,4,5,6,7,8,9) , _
       Array(11,2,3,4,5,6,7,8,9) , _
       Array(111,2,3,4,5,6,7,8,9) , _
       Array(1111,2,3,4,5,6,7,8,9) , _
       Array(11111,2,3,4,5,6,7,8,9) )

dim i
   for i = 0 to 4
       wscript.echo a(i)(0)
   next

Just fastest as it does not use the "expensive" Eval 

(in reply to semihcan)
 
 
Post #: 4
 
 RE: Array String Number... - 5/10/2008 4:23:18 AM   
  dm_4ever


Posts: 2433
Score: 38
Joined: 6/29/2006
From: Orange County, California
Status: offline
Very good point mcnd....I guess it really depend on what the final objective of the scripter is...it could be that this is just something they are playing with to do something similar or different.  If they intend on using something similar to what was posted then yes, your method is faster and should be used if the final script will contain many more arrays with more elements.

_____________________________

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 mcnd)
 
 
Post #: 5
 
 RE: Array String Number... - 5/11/2008 8:25:54 AM   
  mcnd

 

Posts: 23
Score: 0
Joined: 4/27/2008
Status: offline
There are more solutions to the problem than developpers. And if the problem changes, so do the solutions. Just trying to post an alternative.

Thanks

(in reply to dm_4ever)
 
 
Post #: 6
 
 
 
  

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 String Number... 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