Solved

Return Values from a function

Posted on 2001-06-05
3
128 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
3 Comments
 
LVL 4

Accepted Solution

by:
TigerZhao earned 100 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 50

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Run code from text file in vb 1 71
Visual Studio 2005 text editor 10 43
Spell Check in VB6 13 126
VB6 common control 6 sp6 object library not registerd 3 20
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

789 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