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 can i show progress in Progress bar on MDI form from child form

how can i show progress in Progress bar on MDI form from child form

Scheduled Pinned Locked Moved C#
csharpdockerhelpquestion
4 Posts 3 Posters 1 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.
  • W Offline
    W Offline
    wasifmuneer
    wrote on last edited by
    #1

    i am using C#, and in my application there are MID form and other child forms exist, i have placed a progress bar on mdi container, i want that when any child form perform its long processing then the mdi forms progress bar should progress accordingly... like internet explorer any help or code snippet or links may be appreciable.. thanks in advance. Regards

    A S 2 Replies Last reply
    0
    • W wasifmuneer

      i am using C#, and in my application there are MID form and other child forms exist, i have placed a progress bar on mdi container, i want that when any child form perform its long processing then the mdi forms progress bar should progress accordingly... like internet explorer any help or code snippet or links may be appreciable.. thanks in advance. Regards

      A Offline
      A Offline
      Anindya Chatterjee
      wrote on last edited by
      #2

      Follow some simple steps: 1. Make the progressBar internal so that child form can access it. 2. Now access the progress bar like (child.MdiParent as ParentForm).progressBar. 3. Make sure you have a synchronization mechanism is on place so that at a time only one child form can access the proressbar. [where child is the Child Form, ParentForm is the class name of the MDI form and progressBar is the control in MDI form.] Or, if you do not want to expose the control as internal then create some event in Child Form like

      public event EventHandler<ProgressChangedEventArgs> ProgressChanged;

      Then subscribe this event in parent form like

      child.ProgressChanged += Child_ProgressChanged;

      void Child_ProgressChanged(object sender, ProgressChangedEventArgs e)
      {
      // put your code here
      }

      and then call the event from child form like

      if(ProgressChanged != null)
      ProgressChanged(this, new ProgressChangedEventArgs(progressPercentage, null));

      Regards, Anindya Chatterjee[^]

      1 Reply Last reply
      0
      • W wasifmuneer

        i am using C#, and in my application there are MID form and other child forms exist, i have placed a progress bar on mdi container, i want that when any child form perform its long processing then the mdi forms progress bar should progress accordingly... like internet explorer any help or code snippet or links may be appreciable.. thanks in advance. Regards

        S Offline
        S Offline
        StM0n
        wrote on last edited by
        #3

        create an interface with the progressbar-methods and use inheritance...

        (yes|no|maybe)*

        W 1 Reply Last reply
        0
        • S StM0n

          create an interface with the progressbar-methods and use inheritance...

          (yes|no|maybe)*

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

          Thanks for your replies guys.. i got the solution by making progress bar static internal. after dragging the progress bar control on form i made its access modifier internal, and i manually changed some code of progress bar control in Designer.cs file. through this i became able to get the progress bar like, MDIForm.PrgressBar_watinting.value=some value.. Regards

          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