What is the difference between ByRef and ByVal.
When to use ByRef and ByVal

Answers were Sorted based on User's Feedback



What is the difference between ByRef and ByVal. When to use ByRef and ByVal..

Answer / cybergh0st

Byval refers to the actual value of the variable. ByRef
refers to the location of where the value is stored.
Passing.

Is This Answer Correct ?    44 Yes 2 No

What is the difference between ByRef and ByVal. When to use ByRef and ByVal..

Answer / sagar mitra

ByRef refers to the location, ByVal refers to the actual value. Also, if you are passing parameters with "ByVal" then even if the parameter values are changed, the original argument values will remain intact. But if you pass using "ByRef" then if the parameter values are changed, then the original argument value is also modified

Is This Answer Correct ?    26 Yes 1 No

What is the difference between ByRef and ByVal. When to use ByRef and ByVal..

Answer / akshitha

Arguments r of 2 types-
byval & byref
byval-when a method is called using by value & an argument
is passed & if the value of that argument is modified within
that method,orginal argument is not modified

byref-when a method is called by reference & an argument is
passed & if the value of that argument is modified within
that method,original argument is modified

Is This Answer Correct ?    31 Yes 12 No

What is the difference between ByRef and ByVal. When to use ByRef and ByVal..

Answer / manjunathareddy

ByVal :- Byval is address the actual value of the variable.

Ex:- Function abc(Byval var)
var=var+1
End Function

Dim x:x=2
abc x
Msgbox x

In Above example 2 is the Actual value so it address the
actual value,the Result is 2.

ByRef:- ByRef is address the Location of the Stored variable.

Function abc(ByRef var)
var=var+1
End Function

Dim x:x=2
abc x
Msgbox x

In above example it 2 actual value but in byref it refers
the location of the stored variable the result is 3.

Is This Answer Correct ?    13 Yes 1 No

What is the difference between ByRef and ByVal. When to use ByRef and ByVal..

Answer / fgf

Small correction: we have to call the function

Function abc(ByRef var)
var=var+1
End Function

Dim x:x=2
Call abc(x)
Msgbox x

Is This Answer Correct ?    8 Yes 1 No

Post New Answer

More VB Script Interview Questions

write a vb script to rename a folder from tree4 to tree7

3 Answers  


If a calulator having 3 buttons (of any number)in 3 of them one is not working properly due to which answer is wrong always. write a script to find out which button is not working properly ?

0 Answers  


How do you declare a variable in vbscript?

0 Answers  


HOw we can apply web service checkpoint in QTP 9.5? I tried it out with net connection also. But not getting success.

0 Answers  


hi i am trying for testing job for 3+ experience(fake) can u suggest me what type of projects i can keep in my resume and how much of knoeledge i should have abt that project.thnks in advance.urgt plz

0 Answers  






Explain the operator precedence in vb script?

0 Answers  


Hi I am having one folder with set of text files now i want to read and write that text files data into QTP. Any help plsss.

1 Answers  


What is the difference between vb debugger and the script debugger?

0 Answers  


How to pass the parameter from one function to another function in VB Scripting?

1 Answers   Fastenal,


How to use Text file (Notepad) as ur data source in QTP? Can u please provide some function code for it?

1 Answers  


Can automation testing find ssame no. of bugs what we can find by manual testing?

0 Answers  


after medical test,when will be the police verification

0 Answers   IBM,


Categories