Thread: Closing all forms from a derived form

  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, 04:40 AM
  2. Windows Forms
    By ejohns85 in forum C# Programming
    Replies: 2
    Last Post: 05-17-2007, 03: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, 08:55 AM
  5. Making an MFC form to suit
    By TJJ in forum Windows Programming
    Replies: 1
    Last Post: 04-17-2004, 11:20 AM