I personally have always left the constructor alone and just used it to pass
in a reference to the parent form, and used properties across (set/get). I
find that it remains consistent throughout implementing many forms in your
application, more readable, and easier to follow. But in the world of OOP
as you know they say that variables that need to be set during the
initialization of the object should be done in the construction phase, but
only if they need to be initialized at that point. In the case of a form,
actually, your controls need to be set before they are "shown" but not
necessarily when the object is initializing. My 2 cents.
Alex
"Flip" <[remove_me]ph******@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I've seen one way of opening up another form in a C#/WinForms app and I
had done it another way and I would like to know what the gurus think is
the correct/better way?
I've seen one way, where the parent class/form instantiates the child
form, and still in the parent form, sets properties on the child form by
calling methods/properties on the child before before running a
childForm.Show().
The way I had done it was to have a constructor in the child form that
took any/all properties/variables that I wanted to be set, then all I had
to do was instantiate the child form from the parent form and run a
childForm.Show().
What is the prefered way people do this kind of stuff in the real world?
Thanks.