Global variable

  • Thread starter Thread starter Mohammed Abdel-Razzak
  • Start date Start date
M

Mohammed Abdel-Razzak

Dear sirs
How can I declare a variable(Global) that all forms in my
project can see and use it

thanks
Mohammed
 
Mohammed,

The possible things to declare global level may be Enum, Interface, Class,
Struct, delegate.

However, you can define static variables and fuctions inside a class and it
can be used by other classes, without initializing it.

Shak.
 
Hi,

There is not such a concept as a global variable, what you can do is create
a static variable inside a class, this variable can be accessed from all the
classes running on the same AppDomain. and it does exist while it's running.

class Variable_Wrapper
{
static public int I;
}

it can be accessed using
Variable_Wrapper.I


Cheers,
 

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