Skip to content

Tab control previvous forms to close

Nagesh Boddeti

Asked May 19, 2015, 2:09 AM EDT2 answers
Share
LinkedInX
Hi iam using tabcontrol and linked up all individual foms to the MDI PARENT tab control when i open a two or more FORM in MDI parent my previous form is showing , so when a new form open my previous forms has to be closed can anyone help

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Manoj Bhoir
    0
    Hi,
     
    You can use MdiChildren. See below code :
    C#
    private void CloseAllActiveForms()
    {
       Form[] childArray = this.MdiChildren;
       foreach (Form childForm in childArray)
       {
          childForm.close();
       }
    }
    Call this code before opening new Form.
    0
  • 1 short reply
    • 0
      where can i post the code
      0