R
Rob Meade
Hi all,
New to .Net - still finding my feet...quick question...
In one of my functions I have about a dozen variables being declared at the
top - the first thing within the function, about 2 of these may or may not
be used depending on a couple of IF...Then's further down the page...
What I'd like to know is - should I declare ALL of my variables at the top
like this whether they might be used or not - thus keeping them in one easy
to find location for debugging etc etc, or should I declare them just before
I need them, so in my example - maybe something like this :
Dim strString1 as String ' always used
Dim strString2 as String ' always used
If test = true Then
Dim strString3 as String
strString3 = results
End If
Any advice would be appreciated - I'd like to get this correct from the
outset if possible )
Thanks in advance for your replies,
Regards
Rob
New to .Net - still finding my feet...quick question...
In one of my functions I have about a dozen variables being declared at the
top - the first thing within the function, about 2 of these may or may not
be used depending on a couple of IF...Then's further down the page...
What I'd like to know is - should I declare ALL of my variables at the top
like this whether they might be used or not - thus keeping them in one easy
to find location for debugging etc etc, or should I declare them just before
I need them, so in my example - maybe something like this :
Dim strString1 as String ' always used
Dim strString2 as String ' always used
If test = true Then
Dim strString3 as String
strString3 = results
End If
Any advice would be appreciated - I'd like to get this correct from the
outset if possible )
Thanks in advance for your replies,
Regards
Rob