Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can acitvex dll return dictionary object

Status
Not open for further replies.

hinchdog

Programmer
Feb 14, 2001
380
US
that's pretty much my question. i wanted to build a dll that accept a key, value pair, add it to a dictionary object and return that object. however, i wanted to be able to keep adding value pairs to the dictionary object. if you're wondering why i need a .dll to do this it's becuase i want each user to have their own dictionary object. if i just declare a dictionary object on the ASP page, every time it's accessed the dictionary object would be changed for everyone. that is correct, no?
 
No, each dictionary object is a separate object. Do it in your ASP page. No DLL is necessary.

Now, if you try to store it across ASP pages that is a different story and not even a DLL will solve that. If all the data is string, then each dictionary can be saved in a pair of Session Variables by doing
Code:
Session(strName & "keys") = dctd.Keys
Session(strName & "items") = dctd.Items
Retrieve and rebuild the dictionary with
Code:
'****
'* rebuild dictionary
Dim aryKeys
Dim aryItems
aryKeys = Session(strName & "keys")
aryItems = Session(strName & "items")

For I = 0 To Ubound(aryKeys)
    dctd(aryKeys(I)) = aryItems(I)
Next
Each session is separate for each user. I did this because Dictionary objects could not be stored in Session Variables (in ASP 1.x) and it is cleaner anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top