Closing all forms from a derived form

This is a discussion on Closing all forms from a derived form within the C# Programming forums, part of the General Programming Boards category; Is it possible to inherit from a form and in that new derived form close ALL forms? So in the ...

  1. #1
    Registered User
    Join Date
    Aug 2007
    Location
    Gloucester, England
    Posts
    11

    Post Closing all forms from a derived form

    Is it possible to inherit from a form and in that new derived form close ALL forms?

    So in the derived class you would have something like:

    Code:
    protected sealed override void Exit(object sender, EventArgs e)
    {
        // exit all forms here.
    }
    this.Close(); and base.Close(); just close the new instance of the form.

  2. #2
    Registered User
    Join Date
    Aug 2007
    Location
    Gloucester, England
    Posts
    11

    Clarification

    Oh by the way I realise there's the Application.Exit(); function but what I'm after is how to access the controls/form on the derived instance.

    Example - how would I rename a label on the derived form, or create an event that is not implemented in the base form?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 04-02-2009, 05:40 AM
  2. Windows Forms
    By ejohns85 in forum C# Programming
    Replies: 2
    Last Post: 05-17-2007, 04:22 PM
  3. C# Game using Forms
    By ejohns85 in forum C# Programming
    Replies: 1
    Last Post: 12-16-2006, 05:35 PM
  4. My UserControls dissapear off my form
    By zMan in forum C# Programming
    Replies: 2
    Last Post: 09-15-2004, 09:55 AM
  5. Making an MFC form to suit
    By TJJ in forum Windows Programming
    Replies: 1
    Last Post: 04-17-2004, 12:20 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21