Post

 Resources 

Console


RE: thanks rag, we did find the real meaning thoug Adam Hoult (0 replies, 0 views) (2000-Dec-1)
-
Rag is right, ByRef passes the Object or Variable by reference..... This means that it basically passes the pointer to the variable, instead of the value stored inside the variable. So what use is this ?? Well it means you can update the original copy, directly inside the function you passed it to (i.e if you passed an integer BYREF you can modify it's contents and the original will be updated), the other major advantage to this is that if you are passing ByVal, a copy has to be made of the variable when it's passed to the function (using ByRef it doesn't). The latter is not usually a huge problem, however if you are passing say a 5000+ character string to a function many times, better pass it ByRef, or watch your speed plummet =) The reason you pass "Nothing" to a ByRef parameter is simply the same as passing NULL to a pointer based parameter in C++ (NULL references memory address 0x00000000) where you are passing ByVal and you pass 0 to the function, the function itself has to check the value to see if it contains that value, and do what is required (for example 0 may be a totally valid value to pass to one function so you may want to pass -1 to tell it that it should not do anything with this parameter).. This is totally function specific obviously. Adam


-
Up One Level | Back to Forum


Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.
There have been 70 visitors within the last 20 minutes
RSS News Feed