Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can someone explain how to use RETURNs

Status
Not open for further replies.

jpack23

Programmer
Dec 15, 2004
82
0
0
US
I have a shared Sub in a class that calls a shared function in the same class. I would like the Shared fuction to return a value back to the sub.

ex.

Shared sub A

call Shared Function B (this, that)
use StringA
end sub

Shared Function B(this, that)
Dim StringA as string
determine stringA
Return StringA ' return that value back to Sub A
end Function

Am I even close?

Thank you for your help
 
An example function would be declared in the following manner. Note the return type As String
Code:
Function Foo(ByVal str As String) As String
  Dim s As String = str + " world"
  Return s
End Function

The function could be used in the following manner:
Code:
Sub Bar
  Dim s As String = Foo("hello")
  MessageBox.Show(s)
End Sub

Does that help?
 
Thank you, I think I got it now. Thanks for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top