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

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

0 Answers  


Types of cursors in RDO.

0 Answers  


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

1 Answers  


Through which protocol OLEDB components are interfaced?

0 Answers  


what is different from edit and updates?

15 Answers   SoftTech, Wipro,






How to declare Dll Procedure?

1 Answers  


What is the default workspace?

0 Answers  


advantage and disadvantage in visual-basic and ms-access please tell me or send my mail-id

0 Answers  


What is script control?

0 Answers  


what is the Difference between listbox and combo box?

2 Answers  


What are the Internet tools available in VB6.0?

0 Answers   ABC,


What is the latest version of visual basic?

0 Answers  


Categories