vb.net limiting variable scope

  • Thread starter Thread starter kpg
  • Start date Start date
K

kpg

Hi all,

Is there a way to create blocks in vb.net?

I would like to limit a variables scope like this:

begin block
dim myVar as string

...use myVar


end block


....here myVar is not visible


I know that for and do loops hide variables, but is there a way to do it
more generally?

Thanks,
kpg
 
Hi all,

Is there a way to create blocks in vb.net?

I would like to limit a variables scope like this:

begin block
dim myVar as string

...use myVar


end block


...here myVar is not visible


I know that for and do loops hide variables, but is there a way to do it
more generally?

Thanks,
kpg


well that was not too hard...:)

I just did this:

if true then
dim myVar as string
...use myVar
end if
 
Back
Top