Enable a windows form over another one?

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

Guest

I want to disable a form after opening a new one in front of it and i use the
enable property for this as

Form4 newForm = new Form4();
newForm.Show();
this.Enabled = false;
But how can I enable the the previous form over the new form after the job
is finished with the new form that I opened.
 
panda said:
I want to disable a form after opening a new one in front of it and i use the
enable property for this as

Form4 newForm = new Form4();
newForm.Show();
this.Enabled = false;
But how can I enable the the previous form over the new form after the job
is finished with the new form that I opened.

one way is to include a reference in the new form to the old form. (assuming
old form is of type Form3:

public class Form4{

Form3 owner;

public Form4(Form3 caller){
owner = caller;
}


public void OnClose(yadayadayada){

owner.Enabled = true;
}


}
 
In the current form close event or in the Exit button enable the first form
like,

private void Form4_Closed(object sender, System.EventArgs e)
{ {
Form1 oldForm = new Form1();
oldForm.Enabled=true;
oldForm.Show();
}

Cheers, Daya
 
Back
Top