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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

returning Dictionary Object from function

Status
Not open for further replies.

guestAsh

Technical User
Feb 27, 2004
65
GB
Hi - i'm have some problems passing Dictionary Object from a function. i've even found a thread that shows the solution.

Here:
However, what ever i try i get:

Code:
Microsoft VBScript runtime error '800a01c2' 

Wrong number of arguments or invalid property assignment: 'myFields' 

/ibuy/suppliers/Amend/comit/test.asp, line 10

i've gone as far as copying the code from the previouse thread, just to test it, still with no joy...

Code:
function dictionaryTest(myValue)

  set d=CreateObject("Scripting.Dictionary")
  d.add "test", myValue
  set dictionaryTest = d
end function

myFields = dictionaryTest("test")
response.write myFields.Item("test1")

anyone who can help?

thanks

Ash
 
ok worked it out:
Code:
function dictionaryTest(myValue)

  set d=CreateObject("Scripting.Dictionary")
  d.add "test", myValue
  set dictionaryTest = d
end function

[COLOR=red]set[/color] myFields = dictionaryTest("foo")
response.write myFields.Item("test")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top