Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Return Values from a function

Posted on 2001-06-05
3
Medium Priority
?
134 Views
Last Modified: 2010-05-02
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
0
Comment
Question by:Peridot
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
TigerZhao earned 300 total points
ID: 6155355
Function f() As Long
    f = 1
End Function

Sub Main()
    Dim l As Long

    l = f()
    Debug.Print l
End Sub
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 6155359
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
 

Author Comment

by:Peridot
ID: 6155375
Thanks TigerZhao.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question