C# Form Interoperability
Passing form values back and forth in .Net is conceptually tricky for programmers used to working in a non-OOP fashion
Perhaps these programmers started out in languages such as Cobol and VB6. I know I did! (Well,
if you add FORTRAN!).
If you are not used to thinking in an OOP way, you'll find passing values back and forth between
the forms in your application confusing -- and not very well documented.
As a conceptual matter, you need to understand that a form is a class, and you are passing values back and forth to instances of your form classes. The trick is knowing how to refer to the instances. Once you have a name for an instance, you can easily use a variety of methods to pass values (using a public form class variable, using a property procedure, etc).
To start with, I'll go over the patently obvious so that we are sure we are "on the same page."
This article explains the "out-of-the-box" form class code, and how you open a new form instance.
With that under our collective belts, we can move on to the general pattern for passing information
between specific form instances.
|