Hw can i make a variable visible in whole window project?
-
Hi, I require to get a value of varaibale in whole project. How can I ? For exameple, In starting of applicaton i initialize the variable's state. That i require on several Form. I cannot change the name of variable. Any one tried this.Plz give me some hints.... Binod K.
-
Hi, I require to get a value of varaibale in whole project. How can I ? For exameple, In starting of applicaton i initialize the variable's state. That i require on several Form. I cannot change the name of variable. Any one tried this.Plz give me some hints.... Binod K.
Hello, You could use a const or static variable. //mainformcode public const int constint = 100; public static int staticint = 100; public Form1() { InitializeComponent(); } //other class int i1 = Form1.constint; //setting a const variable is not possible at this point (Form1.constint = 200, will not compile) int i2 = Form1.staticint; Form1.staticint = 200; All the best, Martin
-
Hello, You could use a const or static variable. //mainformcode public const int constint = 100; public static int staticint = 100; public Form1() { InitializeComponent(); } //other class int i1 = Form1.constint; //setting a const variable is not possible at this point (Form1.constint = 200, will not compile) int i2 = Form1.staticint; Form1.staticint = 200; All the best, Martin
Martin# wrote:
You could use a const or static variable
A const variable? (const = constant, which means it doesn't change; variable meaning it does change) :-D
Upcoming events: * Glasgow: Geek Dinner (5th March) * Edinburgh: Web Security Conference Day for Windows Developers (12th April) My: Website | Blog | Photos
-
Martin# wrote:
You could use a const or static variable
A const variable? (const = constant, which means it doesn't change; variable meaning it does change) :-D
Upcoming events: * Glasgow: Geek Dinner (5th March) * Edinburgh: Web Security Conference Day for Windows Developers (12th April) My: Website | Blog | Photos