How to return a value from function...?

you should not tell msgbox, print.. etc.,

Answer Posted / vgr

Dim StrFunVal
StrFunVal = fn_MyFunction(7)

Function fn_MyFunction(Num)
fn_MyFunction=Num+8
End Function

During the execution the "StrFunVal" variable will contain
the value 15. If you don't want to use 'Msgbox' or 'Print'
then declaring a variable is prefered.

For your other question I haven't come across returning
more than 1 value from functions. Probably we have to use a
ARRAY kind of stuff...but not sure. Need to work on it.

Cheers,
VGR

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to assign a date value to a variable?

593


hi all, i had a question, that how to find out hiding a coloumn in a table i had a table having the following column names NAME DESCRIPTION CREATED TIME CREATED USER if i right clicked on a NAME column it will displays a menu having the same column names in a list like NAME DESCRIPTION CREATED TIME CREATED USER with check boxes.if i unched any check box, that column name should not be appear in the main table column names could anyone please solve this problem?

1556


How to Convert Hex color code to color name in VB Script?

3936


What are subprocedures in vbscript?

666


What is sql loader? Explain the files used by sql loader to load file?

624






Can u describe what kind of testing are for OTC derivates by banks.

1672


Mention the environments where vbscript could be run?

668


Which in-built functions are used to convert the specified expression in the form of date and string in the vbscript language?

546


What are the naming conventions while declaring a variable in the vbscript language?

621


Which operator is used to perform the comparison among 2 operands in the vbscript language?

532


How can you create a file object to work with the files in the vbscript language?

513


1. How to handle object implementation change in DP for Ex: i have login page with username,pasword (editboxes),login,cancel(buttons). Here i written DP code for login page with the help properties. My questions: 1.If properites are changing dynamically i will do (i want code for that) 2.if objects are changed dynamcally i will do (i wnat code for that)

1622


Mention what is vbscript?

600


when we use filter funtiom invb script(QTP)

2304


I need to get some data from data base and store this (retrieved) data in a excel sheet using VB script in QTP9.0 I have created connection for data base I have created as excels sheet by using Set XL=CreateObject("Excel.Application") XLworksheet.cells(1,1).value= rs.fields.item("<>") I have taken a for loop and changed the cells values (1 as i and another 1 as j) But still I am not able to get Plz kindly tell me know this . It is very urgent

1773