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. to trigger some actions after form load.

to trigger some actions after form load.

Scheduled Pinned Locked Moved C#
databasequestion
5 Posts 4 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.
  • M Offline
    M Offline
    Manu_81
    wrote on last edited by
    #1

    Hi, I want to do some actions immdiately after the form load automatically. How do I do it. If I do in form load then it happens before the form is loaded. But I want to do after the form is loaded. How do I do it..Thanks.

    M 1 Reply Last reply
    0
    • M Manu_81

      Hi, I want to do some actions immdiately after the form load automatically. How do I do it. If I do in form load then it happens before the form is loaded. But I want to do after the form is loaded. How do I do it..Thanks.

      M Offline
      M Offline
      mav northwind
      wrote on last edited by
      #2

      Hi! One solution could be to attach an event handler for Application.Idle in the Load event handler and then perform your work there:

      private void myForm_Load(object sender, EventArgs e)
      {
      // Do whatever you need when the form is loaded
      Application.Idle += new EventHandler(app_Idle);
      }
      private void app_Idle(object sender, EventArgs e)
      {
      Application.Idle -= new EventHandler(app_Idle);
      MessageBox.Show("This happens almost immediately after myForm_Load has returned!");
      }

      Regards, mav

      M W R 3 Replies Last reply
      0
      • M mav northwind

        Hi! One solution could be to attach an event handler for Application.Idle in the Load event handler and then perform your work there:

        private void myForm_Load(object sender, EventArgs e)
        {
        // Do whatever you need when the form is loaded
        Application.Idle += new EventHandler(app_Idle);
        }
        private void app_Idle(object sender, EventArgs e)
        {
        Application.Idle -= new EventHandler(app_Idle);
        MessageBox.Show("This happens almost immediately after myForm_Load has returned!");
        }

        Regards, mav

        M Offline
        M Offline
        Manu_81
        wrote on last edited by
        #3

        perfect..thanks.

        1 Reply Last reply
        0
        • M mav northwind

          Hi! One solution could be to attach an event handler for Application.Idle in the Load event handler and then perform your work there:

          private void myForm_Load(object sender, EventArgs e)
          {
          // Do whatever you need when the form is loaded
          Application.Idle += new EventHandler(app_Idle);
          }
          private void app_Idle(object sender, EventArgs e)
          {
          Application.Idle -= new EventHandler(app_Idle);
          MessageBox.Show("This happens almost immediately after myForm_Load has returned!");
          }

          Regards, mav

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

          Or if you're using .net 2 myForm.Shown += formStartup; void formStartup(object sender, EventArgs e) { }

          1 Reply Last reply
          0
          • M mav northwind

            Hi! One solution could be to attach an event handler for Application.Idle in the Load event handler and then perform your work there:

            private void myForm_Load(object sender, EventArgs e)
            {
            // Do whatever you need when the form is loaded
            Application.Idle += new EventHandler(app_Idle);
            }
            private void app_Idle(object sender, EventArgs e)
            {
            Application.Idle -= new EventHandler(app_Idle);
            MessageBox.Show("This happens almost immediately after myForm_Load has returned!");
            }

            Regards, mav

            R Offline
            R Offline
            RaviGupta7986
            wrote on last edited by
            #5

            Perfectly working. Thanks a lot. :thumbsup:

            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