C# - Close a child form from parent

Posted by Nate Shoffner on Stack Overflow See other posts from Stack Overflow or by Nate Shoffner
Published on 2010-04-07T00:02:55Z Indexed on 2010/04/07 0:13 UTC
Read the original article Hit count: 669

Filed under:
|

I have a parent form and a child form. I need to open the child form at the beginning of a method, do some pretty intensive tasks and then close the child form upon completion.

Here is basically what I've tried so far (with no luck):

Parent Form:

Child child = new Child();

Method()
{
    child.ShowDialog();

    //Method code here

    child.CloseScan();
}

Child Form:

public void CloseScan()
{
    this.Close();
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about parent-child