Adding and Deleting from Arrays 
Author Message
 Adding and Deleting from Arrays

I need code for adding an item to the end of an array and also checking if
the item was already added then not to add it again.

Also how to delete a specific item from array!

Thanks



Tue, 20 Jul 2004 21:59:25 GMT  
 Adding and Deleting from Arrays
It's so much easier to use a Dictionary object and let it do the work for you...

Set myList = CreateObject("Scripting.Dictionary")

myList("abc") = true
myList("foobar") = true
myList("xyz") = true
myList("abc") = true
myList("xyz") = true
myList("foobar") = true

msgbox myList.count

msgbox join(myList.keys,vbCrLf)

--
Michael Harris
Microsoft.MVP.Scripting
--

Quote:

> I need code for adding an item to the end of an array and also checking if
> the item was already added then not to add it again.

> Also how to delete a specific item from array!

> Thanks



Wed, 21 Jul 2004 04:18:58 GMT  
 Adding and Deleting from Arrays
oops, forgot to answer the remove part of the question (still the same solution)...

Set myList = CreateObject("Scripting.Dictionary")

myList("abc") = true
myList("foobar") = true
myList("xyz") = true
myList("abc") = true
myList("xyz") = true
myList("foobar") = true

msgbox myList.count

msgbox join(myList.keys,vbCrLf)

myList.remove("foobar")

msgbox myList.count

msgbox join(myList.keys,vbCrLf)

--
Michael Harris
Microsoft.MVP.Scripting
--
It's so much easier to use a Dictionary object and let it do the work for you...

Set myList = CreateObject("Scripting.Dictionary")

myList("abc") = true
myList("foobar") = true
myList("xyz") = true
myList("abc") = true
myList("xyz") = true
myList("foobar") = true

msgbox myList.count

msgbox join(myList.keys,vbCrLf)

--
Michael Harris
Microsoft.MVP.Scripting
--

Quote:

> I need code for adding an item to the end of an array and also checking if
> the item was already added then not to add it again.

> Also how to delete a specific item from array!

> Thanks



Wed, 21 Jul 2004 08:26:10 GMT  
 Adding and Deleting from Arrays
Don't store any instance of Scripting.Dictionary into Session or
Application variable.

This posting is provided ?AS IS?, with no warranties, and confers no
rights.



Sat, 24 Jul 2004 17:38:12 GMT  
 Adding and Deleting from Arrays
Don't run with scissors ;-)..

--
Michael Harris
Microsoft.MVP.Scripting
--

Quote:

> Don't store any instance of Scripting.Dictionary into Session or
> Application variable.

> This posting is provided ?AS IS?, with no warranties, and confers no
> rights.



Sat, 24 Jul 2004 23:41:49 GMT  
 Adding and Deleting from Arrays

This posting is provided ?AS IS?, with no warranties, and confers no
rights.



Tue, 27 Jul 2004 09:39:10 GMT  
 Adding and Deleting from Arrays
Why not  ? what about in a cookie ,is this possible or allowed?


Quote:
> Don't store any instance of Scripting.Dictionary into Session or
> Application variable.

> This posting is provided ?AS IS?, with no warranties, and confers no
> rights.



Tue, 27 Jul 2004 22:30:33 GMT  
 Adding and Deleting from Arrays
http://www.google.com/search?q=asp+session+apartment+threading

--
Michael Harris
Microsoft.MVP.Scripting
--

Quote:

> Why not  ? what about in a cookie ,is this possible or allowed?



> > Don't store any instance of Scripting.Dictionary into Session or
> > Application variable.

> > This posting is provided ?AS IS?, with no warranties, and confers no
> > rights.



Tue, 27 Jul 2004 23:00:18 GMT  
 Adding and Deleting from Arrays
VBScripting Dictionary Not Safe to Use in IIS Application Scope (Q240415)
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q240415

This posting is provided ?AS IS?, with no warranties, and confers no
rights.



Fri, 06 Aug 2004 15:50:01 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Paradox 'index out of date' message

2. Add and delete array record

3. array of arrays add elements

4. Req: Thoughts on algorithms

5. The weekly FAQ item about the Pascal newsgroups' reorganization

6. Getting or creating indexes for an unknown dBASE or Paradox database at runtime

7. HELP : Delphi and POET Automation

8. script to add and delete users

9. Adding/Deleting users to windows 2000 Database

10. adding and delete printers

11. deleting data from a file, and then adding

12. Add/Delete Printers via WSH

 

 
Powered by phpBB® Forum Software