How to make c# don't call destructor of a instance

Posted by Bình Nguyên on Stack Overflow See other posts from Stack Overflow or by Bình Nguyên
Published on 2012-06-26T17:07:29Z Indexed on 2012/06/27 3:16 UTC
Read the original article Hit count: 157

Filed under:
|
|

I have two forms and form1 needs to get data from form2, i use a parameter in form2 constructor to gets form1's instance like this:

public form2(Form form1) {
this.f = form1;
}

and in form1:

Form form2 = new Form(this);

But it seem form1 destruct was called when i closed form1. my question is how can i avoid this problem?

EDIT: I have many typing mistakes in my question, i'm so sorry, fixed: I have two forms and form2 needs to get data from form1, i use a parameter in form1 constructor to gets form1's instance like this:

private Form f;
public form2(Form form1) {
this.f = form1;
}

and in form1:

Form form2 = new Form(this);

But it seem form1 destruct was called when i closed form2. my question is how can i avoid this problem?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET