Difference between ByRef and ByVal?



Difference between ByRef and ByVal?..

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

More Visual Basic Interview Questions

Maximum Control Names length?

0 Answers  


Can you tell me the properties of the controls?

0 Answers   Satyam,


what are the Default cursor Type and LockEdit type in DAO?

0 Answers  


Difference between Recordset and Querydef?

2 Answers   3i Infotech, IBM, TCS,


What do you mean by Databound Controls? Explain.

1 Answers  






what is the Difference between Tabletype and Snapshot?

0 Answers  


What is the statement to extract 4 characters from the middle of a string?

1 Answers  


what are the Types of ActiveX Components in VB?

1 Answers  


Is it possible to set a shortcut key for label?

0 Answers  


___ property is used to change to ___ value to access a identity column'in datacontrols.

0 Answers  


_____ is the property to ___,____,____ are valid for recordsource property of dat control.

0 Answers  


HTML stands for What? Use of HTML ?

1 Answers  


Categories