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. Windows Forms
  4. Windows Form Shown

Windows Form Shown

Scheduled Pinned Locked Moved Windows Forms
csharpc++visual-studio
6 Posts 3 Posters 20 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.
  • M Offline
    M Offline
    Mateo Hernandez
    wrote on last edited by
    #1

    Hi, guys!. I need one of my forms to do something immediately after the form itself and all the controls are shown (all initialized), but before the user even clicks on anything. THANK YOU! P.S.: I'm not an expert. It's written in C++ .NET using Visual Studio 2010. I tried the Form_Shown event, but it didn't work. Thanks again.

    E 1 Reply Last reply
    0
    • M Mateo Hernandez

      Hi, guys!. I need one of my forms to do something immediately after the form itself and all the controls are shown (all initialized), but before the user even clicks on anything. THANK YOU! P.S.: I'm not an expert. It's written in C++ .NET using Visual Studio 2010. I tried the Form_Shown event, but it didn't work. Thanks again.

      E Offline
      E Offline
      erwinliong
      wrote on last edited by
      #2

      What you need is Windows.Form.Load Event override. See following link for example https://msdn.microsoft.com/en-us/library/system.windows.forms.form.load(v=vs.110).aspx[^]

      M 2 Replies Last reply
      0
      • E erwinliong

        What you need is Windows.Form.Load Event override. See following link for example https://msdn.microsoft.com/en-us/library/system.windows.forms.form.load(v=vs.110).aspx[^]

        M Offline
        M Offline
        Mateo Hernandez
        wrote on last edited by
        #3

        Thanks for the suggestion. I'll try it.

        1 Reply Last reply
        0
        • E erwinliong

          What you need is Windows.Form.Load Event override. See following link for example https://msdn.microsoft.com/en-us/library/system.windows.forms.form.load(v=vs.110).aspx[^]

          M Offline
          M Offline
          Mateo Hernandez
          wrote on last edited by
          #4

          Hi! As you suggested, I tried the example in https://msdn.microsoft.com/en-us/library/system.windows.forms.form.load%28v=vs.100%29.aspx[^] Had to change the code a bit, but managed to get it working and added a Form1_Shown event as well. Two things: 1) IMHO, I think that's what I need instead of a Form1_Load event, because I want to add something after the form has loaded and displayed all the controls with their initial values. 2) I have a bigger question now: What's the practical difference between the load event and the constructor code that I can write at the beginning of the form, right after the InitializeComponent() part? Can you help me? THANK YOU, again!

          S 1 Reply Last reply
          0
          • M Mateo Hernandez

            Hi! As you suggested, I tried the example in https://msdn.microsoft.com/en-us/library/system.windows.forms.form.load%28v=vs.100%29.aspx[^] Had to change the code a bit, but managed to get it working and added a Form1_Shown event as well. Two things: 1) IMHO, I think that's what I need instead of a Form1_Load event, because I want to add something after the form has loaded and displayed all the controls with their initial values. 2) I have a bigger question now: What's the practical difference between the load event and the constructor code that I can write at the beginning of the form, right after the InitializeComponent() part? Can you help me? THANK YOU, again!

            S Offline
            S Offline
            Sascha Lefevre
            wrote on last edited by
            #5

            Mateo Hernández wrote:

            What's the practical difference between the load event and the constructor code that I can write at the beginning of the form

            Please see here: http://stackoverflow.com/questions/2521322/what-setup-code-should-go-in-form-constructors-versus-form-load-event[^] and here: http://stackoverflow.com/questions/3070163/order-of-events-form-load-form-shown-and-form-activated-in-windows-forms[^]

            If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

            M 1 Reply Last reply
            0
            • S Sascha Lefevre

              Mateo Hernández wrote:

              What's the practical difference between the load event and the constructor code that I can write at the beginning of the form

              Please see here: http://stackoverflow.com/questions/2521322/what-setup-code-should-go-in-form-constructors-versus-form-load-event[^] and here: http://stackoverflow.com/questions/3070163/order-of-events-form-load-form-shown-and-form-activated-in-windows-forms[^]

              If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

              M Offline
              M Offline
              Mateo Hernandez
              wrote on last edited by
              #6

              Thank you!!

              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