Not sure about this. According to VB5 Online help...
ByRef Optional. Indicates that the argument is passed by reference. ByRef is the default in Visual Basic.
According to Microsoft Website...
ByVal is default.
Which should I believe?
Printable View
Not sure about this. According to VB5 Online help...
ByRef Optional. Indicates that the argument is passed by reference. ByRef is the default in Visual Basic.
According to Microsoft Website...
ByVal is default.
Which should I believe?
byref is default.
What link did it say either? (ie: post both links)
If you're creating your fuctions, you should explicitly declare whether variables are passed ByRef or ByVal. It's a good habit to keep the guess work out.
Check this link...
http://msdn.microsoft.com/library/de...l/vastmsub.asp
you were looking at .NET documentation.
Shawn
Thanks. I agree... especially since there seems to be a lot of discrepency within Microsoft itself.
Buggy
That brings up a good point. If the default values change (as per MS whim) and we don't explicitly declare ByRef or ByVal, will our software fail???
To further explain...
Please correct me if I'm wrong, as I am quite often. My understanding is that once compiled, the software is converted to machine language... subordient to the machine and operating system it resides on.
If, by default, that operating system assumes ByVal (when not explicitly declared), what guarantees do I have that my program (written and compiled with VB5) will work on Windows 2003?
Your OS has nothing to do with how variables are passed, in respect to BV or BR. Your software will more than likely either fail or product bad output if you meant to pass BV but passed BR or vice versa.
I really really advise explicitly labeling your function decleration's parameters with either BV or BR.
Thanks Shawn...
Your advice is well heeded. In the future, I'll pay more attention and leave less to chance.
Oh... Thanks to you also Buggy...
Your advice always seems solid!