RAFEEK CJ
RAFEEK CJ

Reputation: 41

Form Not getting Closed Completely while using "this.Close()"

I'm Using Visual Studio 2010 And I'm troubling with a problem in my project right now . this question you may feel like foolishness . But i don't know what happening.

In my Project there are 3 forms .

I was trying to Open a form(DisplayFrm) using two Other forms(Form1 and Form2)

This is the code That i used to open the "DisplayFrm" using Both "Form1" and "Form2"

        DisplayFrm.InitialLoadCustProf = RegCustIDtextBox.Text;
        DisplayFrm frm = new DisplayFrm();
        frm.ShowDialog();

The problem is that ,when i am opening DisplayFrm agian using Form2 ,it's not starting as a fresh form . it simply restoring the DisplayFrm which i have already Closed Before with the Operations i have done Already.

Upvotes: 0

Views: 206

Answers (1)

Kai Thoma
Kai Thoma

Reputation: 572

DisplayFrm.InitialLoadCustProf seems to be static. Try to change it to an instance property and open the form like this:

using( DisplayFrm frm = new DisplayFrm() )
{
    frm.InitialLoadCustProf = RegCustIDtextBox.Text;
    frm.ShowDialog( this );
}

Upvotes: 1

Related Questions