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 can you filter out specific type of file using file system controls?

1575


How do I program the Novell NetWare API from VB?

1183


What is ado data control in vb6 0?

864


What is ActiveX Control?

1973


How to customize workgroup message?

810


Is it possible to Manipulate data through flexgrid? Explain.

1748


Explain OLE Drag and Drop.

1677


what are the Types of Resultsets?

1942


Are there any examples of commercial applications built using Visual Basic?

1464


How would you navigate between one document to another document

1393


What are the uses of List View Control?

1648


What are the scope of the class?

1742


Types of DBCombo boxes

1778


how to use telugu language in vb6? any unicode data is available for telugu or not?yes means how to use? my desired output is telugu only? i am doing project like(telugu calendar),my output should be print in telugu only? pls send me the solution with code?

3239


How do I implement Undo?

1166