J-P-W wrote:
Peter wrote:
>"J-P-W" <jo******@gmail.comwrote in news:1157402638.015931.64040@
74g2000cwt.googlegroups.com:
>>Please can you tell me how to call the function 'run it' and find
out the value of 'TheMessage'
Function runit()
If condition Then
runit = "Answer 1"
Else
runit = "Answer 2"
End If
End Function
Response.Write runit
=========================================
If you intent to call this function several times with the same data
being calculated each time, why not use a sub instead ?
Thanks for the reply, I still couldn't get it to work!!! (I'd tried
this also)
Please describe symptoms rather than the meaningless "doesn't work".
Verify that you have followed the above example exactly. I.E., verify
that you have assigned the value you wish the function to return to the
name of the function.
If you still can't get it to work, strip out everything that is not
needed to demonstrate the problem and show us the exact code that
"doesn't work". We need to be able to run the code ourselves, so "air"
code that somewhat resembles your code will not do it. For example, the
above example code cannot be run as-is. Here is a better example that
will work if you place it in a blank asp page:
<%
response.write runit("A")
function runit(parm)
runit = "Answer " & parm
end function
%>
This code works. I've just finished testing it. Try it out yourself and
verify that it works. If it does not work, let us know and describe the
symptoms. If it does work, check to see where the difference is in your
code. If you can't figure out the difference, post the code.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.