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

what are the Differenct Types of Procedures in VB?

0 Answers  


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

0 Answers  


Which property of textbox cannot be changed at runtime ?

3 Answers   JPMorgan Chase,


How do I call a DLL?

0 Answers  


How many tabs in a tabbed dialog do you consider appropriate?

0 Answers  






What are the tools available for Debuggiu in VB?

0 Answers  


What is OLEDB?

0 Answers  


What are 3 main differences between flexgrid control and dbgrid control?

0 Answers  


What is the use of Active Control Property?

1 Answers  


how a multiple routing works ?

0 Answers  


How would you attach an ActiveX control in Your Application?

1 Answers  


What are the different types of Dialog Box?

2 Answers   Apollo, ATTC,


Categories