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. Restarting a form

Restarting a form

Scheduled Pinned Locked Moved C#
question
6 Posts 2 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.
  • L Offline
    L Offline
    Lodeclaw
    wrote on last edited by
    #1

    Hello folks. I have a quick question, so here it is: can I restart a form back to it's original state as if it was newly opened without referencing a parent form or closing it? If so, how? Thanks dudes and dudettes!

    W 1 Reply Last reply
    0
    • L Lodeclaw

      Hello folks. I have a quick question, so here it is: can I restart a form back to it's original state as if it was newly opened without referencing a parent form or closing it? If so, how? Thanks dudes and dudettes!

      W Offline
      W Offline
      Wendelius
      wrote on last edited by
      #2

      Never tried it, but perhaps if you: - set this.components = null - remove all controls from this.Controls - call InitializeComponent

      The need to optimize rises from a bad design.My articles[^]

      L 1 Reply Last reply
      0
      • W Wendelius

        Never tried it, but perhaps if you: - set this.components = null - remove all controls from this.Controls - call InitializeComponent

        The need to optimize rises from a bad design.My articles[^]

        L Offline
        L Offline
        Lodeclaw
        wrote on last edited by
        #3

        Holy crockpot! It works:

        components = null;
        Controls.Clear();
        InitializeComponent();

        Are you some kind of suprogrammer? Thanks, Mika!

        W 1 Reply Last reply
        0
        • L Lodeclaw

          Holy crockpot! It works:

          components = null;
          Controls.Clear();
          InitializeComponent();

          Are you some kind of suprogrammer? Thanks, Mika!

          W Offline
          W Offline
          Wendelius
          wrote on last edited by
          #4

          Lodeclaw wrote:

          Are you some kind of suprogrammer

          Now I have to ask a stupid question: What's a subprogrammer?

          Lodeclaw wrote:

          Thanks, Mika

          You're welcome :)

          The need to optimize rises from a bad design.My articles[^]

          L 1 Reply Last reply
          0
          • W Wendelius

            Lodeclaw wrote:

            Are you some kind of suprogrammer

            Now I have to ask a stupid question: What's a subprogrammer?

            Lodeclaw wrote:

            Thanks, Mika

            You're welcome :)

            The need to optimize rises from a bad design.My articles[^]

            L Offline
            L Offline
            Lodeclaw
            wrote on last edited by
            #5

            Not subprogrammer. Don't make me explain my terrible pun.

            W 1 Reply Last reply
            0
            • L Lodeclaw

              Not subprogrammer. Don't make me explain my terrible pun.

              W Offline
              W Offline
              Wendelius
              wrote on last edited by
              #6

              Ah, I misread it :)

              The need to optimize rises from a bad design.My articles[^]

              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