C# BackgroundWorker and ProgressBar with Cancellation

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ก.ย. 2024
  • C# BackgroundWorker Tutorial and Example with ProgressBar.
    SOURCE CODE REFERENCE : camposha.info/s...
    Backgroundworker;Progress bar;Cancelling;Threads;
    What is one functionality that I cannot do without when making a fairly complex application,its Threads.Yet background worker provides us with a simple class called background worker that abstracts away the difficulty leaving it fairly simple.
    We've written this tutorial with a step by step approach and clear comments.....Enjoy.
    We've covered :
    BackgroundWorker DoWork;
    ,ProgressChanged;
    Completed;CancelAsync; etc

ความคิดเห็น • 58

  • @veliborpjevalica8403
    @veliborpjevalica8403 8 ปีที่แล้ว +3

    This is the only one complete tutorial I have found on Backgroundworker issue. Thank you so much!

  • @michaelgecozo85
    @michaelgecozo85 9 ปีที่แล้ว +2

    This is really a great help to me, since its my first time to use the background worker. Thank you very much for this video toturial.

  • @sakthianand170
    @sakthianand170 9 ปีที่แล้ว +1

    Really helpful. Thanks for making these videos. One thing abt the video. even after cancelling, the whole work completed. so use a return or break statement to stop the work. sorry for bad english

    • @ProgrammingWizards
      @ProgrammingWizards  9 ปีที่แล้ว

      Thanks for the comment and suggestion.I shall have a look at it.

  • @Hermitagup64
    @Hermitagup64 9 ปีที่แล้ว +1

    Really nice video, everything described step by step, great work and Thank you.

  • @shobiatherasa4413
    @shobiatherasa4413 10 ปีที่แล้ว

    your explanation is clear and neat, thank u so much i feel gud because it is easy to understand

  • @vaderjo
    @vaderjo 9 ปีที่แล้ว +8

    I'm now deaf because my audio had to be turned to max, and after the video it blew out and eardrum

  • @jeanhunt2933
    @jeanhunt2933 9 ปีที่แล้ว +2

    This was really helpful, thank you for explaining things so it was easy to understand what each item is doing and why it is needed. Question: how did you add the Background Worker from the toolbar? I don't see that option in mine. Thanks!

    • @ProgrammingWizards
      @ProgrammingWizards  9 ปีที่แล้ว

      Jean Hunt Hello James,thanks first for watching this video and commenting.Which version of Visual Studio are you using?? You should find Background Worker component by just searching in your search box on top of the toolbar.

    • @8maF0
      @8maF0 7 ปีที่แล้ว

      Right click the toolbox and click add from menu. And from the popup dialog select the backgroundworkerprocess from the list of available controls.
      Press ok this will add the backgroundworkerprocess to ypur toolbox.

  • @seventysteven
    @seventysteven 8 ปีที่แล้ว

    Thanks for the video, explains a lot regarding Background Worker :)

  • @premkumarelangovan
    @premkumarelangovan 9 ปีที่แล้ว

    Very useful and very clear. Thanks.

  • @Lulubchannel
    @Lulubchannel 9 ปีที่แล้ว

    Great Video. Thank you for sharing. What I'm curious now is that how would you implement jobs to run in the background. Say I have 10 batch files that installs applications? How can you implement so that it waits for the first batch file to finish and update the progress bar?

  • @ProgrammingWizards
    @ProgrammingWizards  8 ปีที่แล้ว

    SOURCE CODE REFERENCE : camposha.info/source/c-backgroundworker-update-progressbar-cancellation/

  • @emadaldeenmukhtar
    @emadaldeenmukhtar 6 ปีที่แล้ว

    thank you so much, you solved for me CancellationPending

  • @DimaProsto
    @DimaProsto 4 ปีที่แล้ว

    is there a way how to make a pause button using backgroundworker?

  • @bfds89
    @bfds89 8 ปีที่แล้ว

    Hi. Great video.I´m having a little problem with RunWorkerCompleted event.It is not invoked after DoWork is completed.Can you help?Thanks.

  • @hassanesilverlight1550
    @hassanesilverlight1550 8 ปีที่แล้ว

    Thanks ,it is good explained.

  • @MrSavindrasingh
    @MrSavindrasingh 10 ปีที่แล้ว

    Good video.. Please try to keep recording volume high, next time.

    • @ProgrammingWizards
      @ProgrammingWizards  9 ปีที่แล้ว +1

      SavindraSingh Shahoo Thanks for the comment,videos for 2015 onwards are much better in terms of sound quality.

  • @irfanalhafid3738
    @irfanalhafid3738 6 ปีที่แล้ว

    good job mate..

  • @jiyekhcanatuan8315
    @jiyekhcanatuan8315 9 ปีที่แล้ว

    hi nice tutorial, but how about loading a form after the progress bar is at 100%? how will I do that? Please help me..

    • @ProgrammingWizards
      @ProgrammingWizards  9 ปีที่แล้ว

      jiyekh canatuan Hi Jiyekh thanks for commenting,am not getting you well.What do you mean by after progressbar is 100% ?? Here the we are using a loop that counts upto 100.If you have a value greater than 100 then you can still set it as the maximum for ProgressBar.
      This is what is in the tutorial :
      //Maximum value for progressbar
      progressBar1.Maximum=100;
      //Then we looped upto 100 for simplicity
      for(int i=0; i

    • @jiyekhcanatuan8315
      @jiyekhcanatuan8315 9 ปีที่แล้ว +1

      i mean i need to load a form (which takes too much time to load for about 20-30secs) after the progress bar is at 100%.
      Your example in your video, after the progress bar reached 100%, you display a message "successful". in my case i want to load a form.

  • @long_distance_call
    @long_distance_call 8 ปีที่แล้ว

    Thanks man!

  • @renzguinto125
    @renzguinto125 8 ปีที่แล้ว

    When the progressbar is already 100% can i make it show a message ? please reply asap

    • @CezarSystems1990
      @CezarSystems1990 8 ปีที่แล้ว

      Yes! Put your MessageBox at Event ProgressChanged (after line ProgressBar)
      Example:
      private void bw_ProgressChanged(object sender, ProgressChangedEventArgs e)
      {
      this.tbProgress.Text = (e.ProgressPercentage.ToString() + "%");
      MessageBox.Show("Done!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
      }

  • @0XAN
    @0XAN 8 ปีที่แล้ว +1

    can you speak a bit more loud?

  • @ProgrammingWizards
    @ProgrammingWizards  9 ปีที่แล้ว +1

    Hi all,what about a Circular Progressbar and Timer here: th-cam.com/video/xBfiYXBeFBk/w-d-xo.html

  • @davidwoods1813
    @davidwoods1813 7 ปีที่แล้ว

    cant hear youuuuuu...?

  • @tekki.dev.
    @tekki.dev. 7 ปีที่แล้ว

    Your Audio Was out of Sync :P

  • @benja303
    @benja303 6 ปีที่แล้ว

    Are you ugandan?

  • @FEYSCONTROL
    @FEYSCONTROL 7 ปีที่แล้ว

    Man if you want to present something, presenting like it should be. If it is not Ok the first time you will record it second and third. It is useless to offer something to people which they cannot hear. Record it again.

    • @ProgrammingWizards
      @ProgrammingWizards  7 ปีที่แล้ว

      Alright great feedback.This was 2014 and av grown since then. However, I appreciate your feedback and I will take it into account.

    • @FEYSCONTROL
      @FEYSCONTROL 7 ปีที่แล้ว

      I am glad you perceive it as constructive rather than offensive :) Keep goin' :) And always make things better :)

    • @ProgrammingWizards
      @ProgrammingWizards  7 ปีที่แล้ว

      Great.

    • @8maF0
      @8maF0 7 ปีที่แล้ว

      Just do a dubbing on this old video with loud audio again.

  • @vidi2146
    @vidi2146 6 ปีที่แล้ว

    bad tutorial, fix your sound