How to do global vars?

  • Thread starter Thread starter VB Programmer
  • Start date Start date
How do you define a variable as global in VB.NET 2005? Thanks.

VB Programmer in the same way as in the the other VB.Net versions.

By instance global to a class by to declare it private outside a method.

I hope this helps,

Cor
 
the easiest way would be to use a module with a public / friend scoped
declaration
( i would prefer Friend )

please note that you should avoid global scoped variabels

a better aproach would be to encapsulate your logic in a singleton like
base class
that passes all required parameters to its co classes .

you might also investigate the shared keyword

regards

Michel Posseth [MCP]
 
ALL of you.... THANKS!

M. Posseth said:
the easiest way would be to use a module with a public / friend scoped
declaration
( i would prefer Friend )

please note that you should avoid global scoped variabels

a better aproach would be to encapsulate your logic in a singleton like
base class
that passes all required parameters to its co classes .

you might also investigate the shared keyword

regards

Michel Posseth [MCP]



VB Programmer said:
How do you define a variable as global in VB.NET 2005? Thanks.
 

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

Back
Top