Hello!!
I have an application that consist of several windows forms. Lets call these
A,B and C for simplicity.
I have one main meny where the user can choose window form A or B or C.
When a user bring up a window for the first time I create an instance
otherwise I just set visible = true.
When a user brings up a window form for example B and the user click on the
little cross
on the system bar I don't want to close the window form but insted hide the
window form
by setting visible = false.
When the user click on the little cross this event handler A_Closing below
is called.
So hide and show for a window form works good and cause no problem.
private void A_Closing(object sender, System.ComponentModel.CancelEventArgs
e)
{
meltPracCommonControl1.CheckChanged();
FormsManager.Instance.getElementYieldForm().Visibl e = false;
e.Cancel = true;
}
Now to my question: Assume you use this visible=true and visible=false and
you have a field on the form which
says firstPosNumber and you write -1 in this field and then you click on the
little cross to hide and then
bring up the same form again you will see -1 in the field firstPosNumber.
What I want to do is when the user bring up the window form for the second
time
I want to use a method that initialize the window form with (correct data
which is read from the db) data. Note I don't want to instance the
window form from the beginning using the c-tor. So for the example with
this -1 when the form was chosen for the second time
the database was read and return 1 in this field firstPosNumber.
So is it possible to have a call to a method that initialize a form before
the form is shown(visible=true).
//Tony