Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Help - FormClosing event and FormClosed event fires to often

Help - FormClosing event and FormClosed event fires to often

Scheduled Pinned Locked Moved C#
helpquestioncsharp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fracalifa
    wrote on last edited by
    #1

    Hi all, I have an MDI window with a ButtonBar (defined as master) and from there I can call the child windows (outside the master). And from one child window I am calling an DialogWindow. And here comes the problem: :confused: When I am closing this dialog window, the FormClosing event (of the dialog) fires 34 times, and after that the FormClosed event fires 10 times. I am shure that the events are only initialized for one time. So you can say that 3 layers are opened. (MDI-Master --> MDI-->Slave --> DialogForm) It wouldn't be a problem at all, if the dialog window wouldn't hang up. The whole Program stops. in the FormClosing method is only a quiet simple code.

    Dialog_FormClosing(.....)
    {
    try
    {
    Console.WriteLine("closing");
    if(!can_close)
    {
    Messagebox.Show("You have to finish your app first");
    e.Cancel = true;
    }
    else
    {
    e.Cancel = false;
    }
    }
    catch
    {
    }
    }

    The question is: Why fires the event so often ? And why hangs up the dialog (the dialog does not close) Some ideas ? - using .NET 2.0.xxx Tnx Frank

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups