Proper closing methods of a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Looking for a proper way to close or hide a form in this example.

I have a form X that calls a new form Y to show on a given event.
Both X and Y are different classes.

Ive tried instancing X and calling X.Close(); and X.Hide(); from within X.
Ive tried instancing X from within Y and calling close and hide there also.

Both fail to hide/close form X

Heres some actual code :

//new form to display
cellinfo = new addcellinfo ();
cellinfo.Show();

// this current form(the call from class) isnt needed anymore

addup = new addupdate ();
addup.Close();

I Imagine its a control issue??

Thanks for any advice.
 
I don't quite understand your problem. Here's what I understand: you
want to close a parent form when it Shows another form. A sort of
toggle?

Did you try using "this.Close()" on Form X ? You don't instantiate a
form if it is itself.
 
Back
Top