Difference between ByRef and ByVal?

Answer Posted / suresh

Only a copy of a variable is passed when an argument is
passed by value. If the procedure changes the value, the
change affects only the copy and not the variable itself.
Use the ByVal keyword to indicate an argument passed by
value.

Passing arguments by reference gives the procedure access
to the a1ctual variable contents in its memory address
location. As a result, the variable's value can be
permanently changed by the procedure to which it is passed.
Passing by reference is the default in Visual Basic.
If you specify a data type for an argument passed by
reference, you must pass a value of that type for the
argument. You can work around this by passing an
expression, rather than a data type, for an argument.
Visual Basic evaluates an expression and passes it as the
required type if it can.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I get the Tab key to be treated like a normal character?

1108


What is the use of property page Wizard in ActiveX Control?

2090


How do I tell when an application executed using the SHELL command is finished?

1177


Differentiate between DAO,ADO and Adodc as in data access objects?

6433


how to use unicode data in vb6 regarding to telugu language, my output is in only telugu language

3205






Which method is used to write context Into file?

1664


What is the use of debug Window?

1632


How do I add a form in visual basic?

612


_____ collection in recordset used to assign a value from textbox to table columns without making abinding in datacontrol.

1383


I'm getting error message "Reserved Error [-nnnn] ("There is no message for this error")" from Jet Engine 2.0.Why?

1153


Is it possible to change menu runtime using API? If yes Specify the function names?

1560


How would you map properties to controls by using ActiveX Control Interface Wizard?

1521


How do I program the Novell NetWare API from VB?

1067


what are the types of LockEdits in DAO?

1596


Is it possible to Manipulate data through flexgrid? Explain.

2139