J
Jamey Bon
I am a C# newbie. I am having a tough time with several issues of scope
and visibility.
In short, why can't I see any of the elements of Form1 (the base form
generated by the "Windows Application Project Wizard") from anywhere else
in my project? For example, why can I not change the text of a TextBox
control from Main() (which is, by default, in the Program class) even
after I have set its visibility to public in Form1? Furthermore, I can
add a class to the project, make sure it and its fields are public,
instantiate an object of that class (say, in Main()) but won't be able to
see that class's public fields from within Form1. This seems to all hold
true even if I am using the fully qualified (starting with the namespace)
name.
This is actually a smaller part of my larger attempt to understand how to
organize a program into a decent object-oriented, modular design. I have
tried to find some good code samples of such, but so far have failed.
So, can someone please put me on the right track to understanding how the
visibility and scope is working in these cases? Thank you very much.
JB
and visibility.
In short, why can't I see any of the elements of Form1 (the base form
generated by the "Windows Application Project Wizard") from anywhere else
in my project? For example, why can I not change the text of a TextBox
control from Main() (which is, by default, in the Program class) even
after I have set its visibility to public in Form1? Furthermore, I can
add a class to the project, make sure it and its fields are public,
instantiate an object of that class (say, in Main()) but won't be able to
see that class's public fields from within Form1. This seems to all hold
true even if I am using the fully qualified (starting with the namespace)
name.
This is actually a smaller part of my larger attempt to understand how to
organize a program into a decent object-oriented, modular design. I have
tried to find some good code samples of such, but so far have failed.
So, can someone please put me on the right track to understanding how the
visibility and scope is working in these cases? Thank you very much.
JB