Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3440246
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:24:34+00:00 2026-05-18T08:24:34+00:00

I have a class written in C#. In it I want to run a

  • 0

I have a class written in C#. In it I want to run a certain function in parallel on a list. After it completes on each item I would like to update a progress bar. However, I get very odd behavior from my program. It executes the event and reaches my sub but never proceeds to actually execute any code. Instead it just freezes. (I’ve mixed vb.net and c#. It will be rewritten at some point)

so in my windows form I call

    progressBar.Visible = True
    progressBar.Value = 0
    progressBar.Maximum = dataGrid.SelectedRows.Count

    AddHandler quoteManager.refreshStarted, AddressOf progressBarCounter
    quoteManager.refreshAllAsync(list)

and the event is simply

Private Sub progressBarCounter()
    Me.Invoke(Sub()
                  If progressBar.Value = progressBar.Maximum Then
                      progressBar.Visible = False
                  Else
                      progressBar.Value += 1
                  End If
              End Sub)
End Sub

and in the quote manager class I have this defined.

    public event Action refreshStarted;

    public void refreshAllAsync(List<BindableQuote> bindableQuotes)
    {
        bindableQuotes.AsParallel()
            .WithDegreeOfParallelism(10)
            .ForAll((quote) => {
                quote.refreshAll();
                if (refreshStarted != null) { refreshStarted(); }
            });
    }

So for some reason I get it to enter progressBarCounter on each item in the list but it never exists. Instead it just keeps the form frozen.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T08:24:35+00:00Added an answer on May 18, 2026 at 8:24 am

    I am not exactly sure this is what is happening, but it looks like progressBarCounter is blocking because you are calling Invoke. Should you be using BeginInvoke instead? Using BeginInvoke might solve the deadlock issue. See this post: What's the difference between Invoke() and BeginInvoke()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program written in C#. I want the Timer class to run
I have a class that I've written a TypeConverter for. I want to keep
I have a class I've written to act like an enumeration: abstract class Enum
I have a class library that I have written in C#.net. I want to
I have a class and methods inside it written in C#. I want to
I have written a common class which I want to use in separate Blackberry
I have written servlet.I want to test the functionality of my servlet class ,so
I want another developer to run a Perl script I have written. The script
i have written the code like below public class SplashScreen extends BaseActivity{ public void
I have written my own java.util.List implementation, and now i want to store it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.