Search code examples
c#.netwinformstabsmdi

C# tabbed MDI forms: Always last tab is closed


I was following the tabbed MDI forms example from HERE. I just copied the code into a test application.

The problem is, that if I press the "X" button to close a form, always the last tab closes and not the selected one. But in the example solution it works perfectly. However I can't find any difference in code, properties or events to my test project.

I hope someone gives me a hint.


Solution

  •   private void tabForms_SelectedIndexChanged(object sender, EventArgs e)
    

    you may missed this code of , forgot the event binding with this