Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Retrieve unselected list Items

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Retrieve unselected list Items
  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 >>
 Retrieve unselected list Items - 8/9/2006 2:47:47 AM   
  Bucfast

 

Posts: 2
Score: 0
Joined: 8/9/2006
Status: offline
Hi I'm relatively new to VBscript and have a problem.

I have 2 listboxes, the first has a list of computers, the user selects which computers it wants to check, and as they do the selected ones get moved into a second listbox.

I now want to add the computers in the second listbox (selected computers) to an array.

"
For n = 0 to z
check(n) = form1.selectedList(form1.selectedList.Index(n)).Text

Next

"

Its the Index bit that isnt right. I basically want it to loop through each item in the listbox and add it to the array "check" (z is the number of items in the listbox obviously).

So my problem is I cant work out how to tell Vbscript to read in just one item from a listbox.

Any help appreciated.
 
 
Post #: 1
 
 RE: Retrieve unselected list Items - 8/9/2006 3:10:38 AM   
  Snipah


Posts: 1343
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline


Try looking at the :

OnChange="javascript:alert(this.options[this.selectedIndex].value);"

_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com

(in reply to Bucfast)
 
 
Post #: 2
 
 RE: Retrieve unselected list Items - 8/9/2006 3:40:48 AM   
  ehvbs

 

Posts: 2221
Score: 50
Joined: 6/22/2005
From: Germany
Status: online
Hi Bucfast,

maybe I misunderstand your problem, but if you want to get the items
of the second listbox into an array, this may help:


      

Good luck!

(in reply to Snipah)
 
 
Post #: 3
 
 RE: Retrieve unselected list Items - 8/9/2006 8:12:58 PM   
  Bucfast

 

Posts: 2
Score: 0
Joined: 8/9/2006
Status: offline
Ahhh legends you guys are, yes /yoda

Thanks alot for that, sorted! Snip kinda scared me with the Javascript onChange command, although I may look into it when I get this finished, so I went with ehvbs' vbscript:

"For theIndex = 0 to z
  
check(theIndex) = selectedList.Options(theIndex).Text

Next"

along with the getelementbyid it worked a treat. I will keep checking back on here, see if I can return the favour to someone else with my limited but developing knowledge on vbscript :P

(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 >> Retrieve unselected list Items 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