Is it possible for a function to return a dictiona

Results 1 to 3 of 3

Thread: Is it possible for a function to return a dictiona

  1. #1
    Join Date
    Dec 1969

    Default Is it possible for a function to return a dictiona

    I want a function to return more then one value.. and i&#039;ve previously done this using an array.. but it very confusing when calling the values back from the array, because i have to use numbers that don&#039;t mean anything. <BR><BR>function getMessageParts() <BR>&#039;--create Dicrionary object that will store the message parts in name/value pairs <BR>dim objDic <BR>set objDic = server.CreateObject("Scripting.Dictionary") <BR><BR>&#039;--add values to the dictionary object <BR>objDic.Add "from", strFrom <BR>objDic.Add "fromAddr", strFromAddrOriginal <BR>objDic.Add "subject", strSubject <BR>objDic.Add "date", strDate <BR><BR>&#039;--retnurn the dictionary object that contains all the message parts <BR>getMessageParts = objDic <BR>end function

  2. #2
    Join Date
    Dec 1969

    Default Of course...

    How did you assign the object to your objDic variable? Hmmm???<BR><BR>So you have to do the same to assign objDic to the function name:<BR> SET getMessageParts = objDic<BR><BR>And don&#039;t forget to use SET once again when you assign the function in the code that calls the function:<BR> Set Whatever = getMessageParts( )<BR>

  3. #3
    Join Date
    Dec 1969

    Default Surely. One Problem

    When a function returns an Object, you need to use the Set command just like you did:<BR><BR>set objDic = server.CreateObject("Scripting.Dictionary") <BR><BR>You need to do:<BR>Set getMessageParts = objDic<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts