Possibly Dumb Function Question

Results 1 to 2 of 2

Thread: Possibly Dumb Function Question

  1. #1
    Join Date
    Dec 1969

    Default Possibly Dumb Function Question

    Hi,<BR><BR>I&#039;ve probably missed something really stupid here, but can y&#039;all take a look at this code and tell me why the function doesn&#039;t seem to be returning any values?<BR><BR>Function GetParent(FolderName, txtForCheck)<BR> <BR> Set Folderobject = CreateObject("Scripting.Filesystemobject")<BR> Set fldThisFolder = FolderObject.GetFolder(Foldername)<BR> ParentFolder = fldThisFolder.ParentFolder<BR> <BR> If left(txtforCheck,2) = ".." Then<BR> txtforCheck = right(txtforCheck,len(txtForCheck) - 3)<BR> GetParent ParentFolder, txtForCheck<BR> Else<BR> GetParent = fldThisFolder & "/" & Txtforcheck<BR> Response.Write("GETPARENT = " & GetParent)<BR> End If<BR> <BR>End Function<BR><BR>Function AnotherFunction(blah)<BR><BR> ...(various code)<BR> If left(txttocheck,2) = ".." Then<BR> <BR> Dim backPath<BR> backPath = GetParent(objFolder.path,txttocheck)<BR> Response.Write("Backpath = " & backpath)<BR> <BR> End If<BR> ...(various code)<BR>End Function<BR><BR>Now can anyone tell me why the computer writes a value for GETPARENT when it&#039;s within the loop, but the variable backpath never has a value?

  2. #2
    Join Date
    Dec 1969

    Default RE: Possibly Dumb Function Question

    response.Write writes html output to the browser not return value from a finction.If you want to return a value from a function do it like this<BR><BR>vb<BR><BR>function myfunc() &#039;possible input parms<BR>&#039;do something<BR>myfunc = something<BR>end function<BR><BR>javascript<BR><BR>function myfunc(){<BR>//do something<BR><BR>return something;<BR>}<BR><BR>where something is some variable or value

Posting Permissions

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