enable a form from another form.

how can i enable or disable a form from another form  
eg: i have a project prs.
and 2 forms
pr_menu and person.
person should open on top of pr_menu. at the same time when person is opened, pr_menu must be disabled.

i tried by the following coding.

frmHandlePerson pers = new frmHandlePerson();
pers.Show();
this.Enabled = false;
pers.Focus();

but, from frmHandlePerson, i am not able to enable pr_menu back.. when i required so..

i am new in Windows Forms.. 

please mail me on sheeja_aj@hotmail.com or please come online on MSN if possible.
thanks in advance.

Sheeja


Answer this question

enable a form from another form.

  • dehjli

    Can't your create a variable in the 2nd form and them pass the first form ("this") to that 2nd form variable when you open it  Then, in the 2nd form, you would variable.enable = true.

    Here's this in VB.Net (I don't know C# to give the xample in C#)

    Form1:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim form2 As New Form2
            form2.Show()
            form2.frm = Me
            Me.Enabled = True
            Me.Enabled = False
            form2.Focus()
    End Sub

    Form2:

    Public frm As Object

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            frm.visible = True
            frm.enabled = True
    End Sub



    Bye

  • enable a form from another form.