Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Returning objects from function

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> Returning objects from function
  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 >>
 Returning objects from function - 1/12/2004 12:19:07 AM   
  selenwall

 

Posts: 2
Score: 0
Joined: 1/12/2004
From:
Status: offline
Hi,

Why don't this work?

Function openXML (xml_name)
Set xml_object = CreateObject("Microsoft.XMLDom")
xml_object.async = false
xml_object.load (Server.MapPath(xml_name))
openXML = xml_object
End Function

ASP complains about the last row where I want to return the object.
 
 
Post #: 1
 
 RE: Returning objects from function - 3/30/2006 3:33:33 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
Old question, but it crops up every once in a while so I figure an answer is worth the effort so that people will find it with a search.

To pass an object back out of a function, you need to use Set. So, for the code posted you would need to do:

Function openXML (xml_name)
Set xml_object = CreateObject("Microsoft.XMLDom") 
xml_object.async = false
xml_object.load (Server.MapPath(xml_name))
Set openXML = xml_object
End Function

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to selenwall)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> Returning objects from function 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