Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How to return a value from function...?

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

Answers were Sorted based on User's Feedback



How to return a value from function...? you should not tell msgbox, print.. etc.,..

Answer / bfakruddin

in VB Script

Is This Answer Correct ?    3 Yes 1 No

How to return a value from function...? you should not tell msgbox, print.. etc.,..

Answer / 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

How to return a value from function...? you should not tell msgbox, print.. etc.,..

Answer / rishi agrawal

Function MyFunction(Num)

InputBox("What is your name?","My Input")
'Code for return value from function
MyFunction= Num + 1

End Function

Is This Answer Correct ?    3 Yes 2 No

How to return a value from function...? you should not tell msgbox, print.. etc.,..

Answer / siba sankar nayak

In which language?
In C. C++, Java like language,
we can use "return" key word to returnd values from
functions.

Is This Answer Correct ?    1 Yes 1 No

How to return a value from function...? you should not tell msgbox, print.. etc.,..

Answer / bfakruddin

Function MyFunction(Num)

MyFunction=Num+1

End Function

Num=InputBox("Enter a Number")

call MyFunction(Num)
msgbox MyFunction 'It returns Num+1 value calculated in
Function

Just we have to use the Function Name to return a value...
and we can use that value out of that function...

One more question Can we return more than 1 value from
functions?


visit for qtp info http://qtptesters.wordpress.com

Is This Answer Correct ?    1 Yes 1 No

How to return a value from function...? you should not tell msgbox, print.. etc.,..

Answer / selva

yes function can return multiple vales.
Public Function fn()
Dim arr(1)
arr(0)=23
arr(1)=67
fn=arr
End Function
a=fn

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More VB Script Interview Questions

Plz give the vb script for the following scenerio. In travel booking we have to select from delhi to mumbai from the combobox The prices will be display in another combo box .But i have to select the lowest price for it and submit it

1 Answers   IBM,


find the length of the string without using length function?

4 Answers   CSS Corp,


What is the purpose of regexp object in vbscript?

0 Answers  


print the array values in ascending order?

2 Answers   CSS Corp,


what is the difference between modular and data and keyword driven framework

0 Answers  


How to return a value from function...? you should not tell msgbox, print.. etc.,

6 Answers  


compare the string without using stringcomp function?

1 Answers   CSS Corp,


Which function is used to perform string comparison?

0 Answers  


How will you convert a string to lower case string using vbscript?

0 Answers  


What is byref and byval parameters in vbscript?

0 Answers  


Give examples where vb script can directly run on users system with windows as os?

1 Answers  


How to scroll down a page while recording in qtp. suggest me any method apart from low level recording.

0 Answers  


Categories