How do I access public members from different classes at runtime? For example, I have a C#.NET project that uses multiple forms and I need to be able to get values from controls entered by the user between them.
I've tried adding a public integar to the first form and assigning a value using a method, e.g.:
Expand|Select|Wrap|Line Numbers
- public int myInt = new int();
- public void myMethod()
- {
- //other code that need be done...
- myInt = (int)myControl.Value;
- }
I have also tried the regular object reference from the second form, e.g.:
Expand|Select|Wrap|Line Numbers
- myForm instance = new myForm();
- int myInt = (int)instance.myControl.Value;
Please help!
Demonweare