There isnt any blanket rule I can give for you to follow, youre going to have to use your brain and apply the knowledge we've given here:
When the executing thread leaves a block of code (in C# this is easy to define.. a block is everything between { }, in VB its harder to explain.. but a block is anything that causes the IDE to INDENT your code) all variables declared within it are dissolved.
THis is called "scope" - when a variable falls out of scope, it is dissolved
Variables are just pointers to data in memory
When there are no more surviving pointers to that data, the data is put out to trash, but it isnt released straight away
Periodically, like in the real world the garbage truck comes to your house once a week, the Garbage Collector cleans up all the trash data. You have no control over when it does this, but rest assured that some very clever people at Microsoft has spent a long time figuring it out.
If you dont put your bins out, the garbage truck cant collect. If you set A_VARIABLE = Nothing, you are putting the bins out. You might decide to do this before you go on a long holiday (start performing a long operation) or you might not.. If you do, there isnt any guarantee that the garbage truck will come while youre away but if it does come it will clean up.
-
It might help you to know that it is very, very rare that I Dispose() of objects and set them to Nothing myself.. I do it for streams, and sockets as soon as I'm finished with them, because keeping reference can keep a lock on the operating system file meaning other programs cant use it for extended periods of time, but I dont do it for integers and crap like that
So, I guess a blanket rule would be: Close(), Dispose() and Set Nothing your streams, but the rest of the stuff, let .NET do it with scoping