Basic question about ByVal and ByRef time span

ParaChase

Member
Joined
Jun 17, 2012
Messages
8
Programming Experience
Beginner
How long do these passing methods last? I just want to make sure that I have these lifespans correct. ByVal variables lasts for the entire program time, while ByRef variables last until the procedure ends. Am I correct?
 

Herman

Well-known member
Joined
Oct 18, 2011
Messages
882
Location
Montreal, QC, CA
Programming Experience
10+
ByVal and ByRef only determine how a variable is passed to a method. Either as a value, which means the variable is copied and exists only within the called method, or as a pointer to the original object, which means the original object passed is the one being modified. There is no time factor involved.
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,603
Location
Norway
Programming Experience
10+
Top Bottom