Home All Groups Group Topic Archive Search About

Enable a windows form over another one?

Author
5 Jun 2005 7:25 PM
panda
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.

--
hard can be achieved!

impossible takes a little time!
Author
5 Jun 2005 9:57 PM
Andreas.Knudsen(AT)bekk.no
"panda" wrote:

> 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;
    }


}
Are all your drivers up to date? click for free checkup

Author
13 Jun 2005 9:16 AM
Daya PSP
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
Show quoteHide quote
"panda" wrote:

> 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.
>
> --
> hard can be achieved!
>
> impossible takes a little time!

Bookmark and Share