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. how to update progressbar in Child Form from Parent Form

how to update progressbar in Child Form from Parent Form

Scheduled Pinned Locked Moved C#
tutorialannouncement
5 Posts 3 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.
  • S Offline
    S Offline
    sandy_557
    wrote on last edited by
    #1

    please provide any sample code

    R B 2 Replies Last reply
    0
    • S sandy_557

      please provide any sample code

      R Offline
      R Offline
      Rick van Woudenberg
      wrote on last edited by
      #2

      Parent Form :

      public ProgressBar pb;

      private void openChild_Click(object sender, System.EventArgs e)
      {
      ChildForm cf = new ChildForm();
      cf.pf = this;
      cf.open();
      }

      Child Form :

      public ParentForm pf;

      private void runProgressBar_Click(object sender, System.EventArgs e)
      {
      for(int i = 0;i<100;i++)
      {
      pf.pb.Value++;
      }
      }

      B S 2 Replies Last reply
      0
      • S sandy_557

        please provide any sample code

        B Offline
        B Offline
        benjymous
        wrote on last edited by
        #3

        Simplest method is to add events to your child form that the parent subscribes to when the form is created. You can then use these to notify the parent that the progress needs changing. Any sample code? Here's Hello World as a Vax-11 macro[^]

        Help me! I'm turning into a grapefruit! Buzzwords!

        1 Reply Last reply
        0
        • R Rick van Woudenberg

          Parent Form :

          public ProgressBar pb;

          private void openChild_Click(object sender, System.EventArgs e)
          {
          ChildForm cf = new ChildForm();
          cf.pf = this;
          cf.open();
          }

          Child Form :

          public ParentForm pf;

          private void runProgressBar_Click(object sender, System.EventArgs e)
          {
          for(int i = 0;i<100;i++)
          {
          pf.pb.Value++;
          }
          }

          B Offline
          B Offline
          benjymous
          wrote on last edited by
          #4

          Ick, I hope that was intentionally ironic!

          Help me! I'm turning into a grapefruit! Buzzwords!

          1 Reply Last reply
          0
          • R Rick van Woudenberg

            Parent Form :

            public ProgressBar pb;

            private void openChild_Click(object sender, System.EventArgs e)
            {
            ChildForm cf = new ChildForm();
            cf.pf = this;
            cf.open();
            }

            Child Form :

            public ParentForm pf;

            private void runProgressBar_Click(object sender, System.EventArgs e)
            {
            for(int i = 0;i<100;i++)
            {
            pf.pb.Value++;
            }
            }

            S Offline
            S Offline
            sandy_557
            wrote on last edited by
            #5

            i want to update progressbar in Child form not in Parent form

            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