Return Values from a function

Hello all,
I am new to VB, and I would like to know how to pick up the return value of a function (any function)?

any suggestions
P
PeridotAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
TigerZhaoConnect With a Mentor Commented:
Function f() As Long
    f = 1
End Function

Sub Main()
    Dim l As Long

    l = f()
    Debug.Print l
End Sub
0
 
Ryan ChongCommented:
Hi, here is a sample:

___________________________________________

use like this: Text1.Text = returnValue(3)

Private Function returnValue(ByVal ivalue As Integer) As String
    Select Case ivalue
    Case 0
        returnValue = "A"
    Case 1
        returnValue = "B"
    Case 2
        returnValue = "C"
    Case Else
        returnValue = "D"
    End Select
End Function

'Hope will help.
0
 
PeridotAuthor Commented:
Thanks TigerZhao.
0
All Courses

From novice to tech pro — start learning today.