What is the difference between ByRef and ByVal.
When to use ByRef and ByVal
Answer Posted / 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 |
Post New Answer View All Answers
Which object is used to work with the database in the vbscript language and what statement is used to create this object?
How are comments handled in the vbscript language?
What is the purpose of folders object of scripting.filesystemobject class in vbscript?
How to pass argument by reference to a function in vbscript?
What are the differences between sub procedures and function procedures?
Explain about adodb.stream class?
Why to use option explicit in vb script?
Which object is used to work with the excel sheets in the vbscript language and what statement is used to create this object?
How are values assigned to string type and numeric type variables?
Hello friends..... Can any give the methods for Ms-Access, and Mozilla firefox in Automation Object Model in QTP. Please give me currect answers... if you do not understand my question please don't give answers. Thanking you.
Write a Script for ATM in QTP
what is inner join? what is outer join? what is a constraint? tell me about rdbms? tell me about acid properties?
Compare java script and vb script?
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 ?
How to use QTP Object in .vbs(vbscript file) file Ex: Browser().., wait(), exist() and etc...