Return a string from a function

constantG

Registered User.
Local time
Today, 18:59
Joined
Jun 24, 2009
Messages
92
I have a public function which I d/l from the net which removes punctuation from a string. The string is derived from a text box on a form. I know how the function works and how to send the string to the function. My question is: once the function is complete how is the string passed back to the text box. My own thought was that you use a return command but I am baffled.

All help appreciated.

Thanks.
 
Code:
Function Test(AnyString As String) [COLOR=red]As String[/COLOR]
.... do your thing
[COLOR=red]Test = ResultsOfFunction[/COLOR]
End Function

Add the red parts to your function and it will return the answer back to the calling sub

Hope this helps

JR
 
I'm pretty sure you can just put the name of the function as the control source of a text box, as long as it's public. But yes you have to declare that the name of the function = the name of the variable used to store the results of the function at the end, otherwise it won't work.
 

Users who are viewing this thread

Back
Top Bottom