vb.net limiting variable scope

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
 
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


well that was not too hard...:)

I just did this:

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top