Form remains open after this.close()

Asked

Viewed 62 times

0

I have a main menu form, which calls the student register.

But the exit code of the student form does not close it, calls the main form but it remains open in the background and I can’t even close it manually.

Code to open the registration menu:

frmCadAluno oloko = new frmCadAluno();
this.Visible = false; 
oloko.ShowDialog(); 

Code to close:

FrmMenuPrincipal oloko = new FrmMenuPrincipal();
oloko.ShowDialog();
this.Close();
this.Dispose();
  • 2

    "code to open", which source form? is the main menu? In the "close code", try closing the current form before opening the main menu

  • Misplaced question. Improve it there.

  • 1

    @Augustovasques

  • You are opening the oloko and closing this, which would be the form that opened the oloko, try oloko. Close()

  • @Augustovasques I apologize, first time using stackoverflow. My mistake was in showdialog, it should be just show().

Show 1 more comment

1 answer

4

The mistake was using showdialog() instead of show().

  • +1 for having answered an unintelligible question. Even if it is yours.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.