Resetting a variable to nothing

  • Thread starter Thread starter Todd Huttenstine
  • Start date Start date
Actually you don't have to set regular variables to nothing; it's onl
for object variables
 
And it is debatable whether you even need to set these to nothing. See
http://tinyurl.com/2sdxp for a previous exchange on this topic.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Hi
If it is an object variable use

Set object = Nothing

This is done to release memory. For other variables (Boolean, Double
etc) you should not need to set their value to nothing. A variable
defined inside a sub for example only exists for the lifetime of that
sub. During the sub, the variable is initialised to have some value
(otherwise you wouldn't define it in the first place) and ceases to
exist in memory at the end of the sub. There should not be a reason to
say the variable has no value - I don't know a lot about the memory
implications of variable declarations in VB mind, so don't take this
as Gospel!

regards
Paul
 
Back
Top