0

In the init method of an intermediate form I'm trying to open a new form and close current one. Below code opens the second form however with an error message "cannot call close without detach or wait" although I tried adding element.detach() but error persists

void Init()       
   {

    FormRun formRun;
    Args args = new Args();
          
    super();   
            
    element.close();//can't close  

    args.name(formstr(Form1));
    formRun = ClassFactory.formRunClass(args);

    formRun.init();
    formRun.run();
    formRun.detach();
}
piku
  • 471
  • 4
  • 12
  • 44

1 Answers1

1

On the intermediate form overridden the run() method and after super wrote

element.detach();
element.close(); 

and therefore it worked.

piku
  • 471
  • 4
  • 12
  • 44