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 8377501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:41:13+00:00 2026-06-09T15:41:13+00:00

i am using multiple threads to do some processes and i want to display

  • 0

i am using multiple threads to do some processes and i want to display the total progress in a progressbar so How can i do the ProgressBar1.Increment(1) in a safe way?

Public Sub thread1process()
    For i = 0 To t1.Rows.Count - 1
        t1.Rows(i)("cname") = "Thread1"
        t1.Rows(i)("PD") = i
        t1.Rows(i)("PDP") = i
        t1.Rows(i)("TPD") = i
        t1.Rows(i)("TPDP") = i
        ProgressBar1.Increment(1)
    Next
End Sub

Public Sub thread2process()
    For i = 0 To t2.Rows.Count - 1
        t2.Rows(i)("cname") = "Thread2"
        t2.Rows(i)("PD") = i
        t2.Rows(i)("PDP") = i
        t2.Rows(i)("TPD") = i
        t2.Rows(i)("TPDP") = i
        ProgressBar1.Increment(1)
    Next
End Sub

also how would i increase a public variable from multiple threads in the same time?

  • 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-06-09T15:41:15+00:00Added an answer on June 9, 2026 at 3:41 pm

    How can i do the ProgressBar1.Increment(1) in a safe way?

    You could use the Invoke method on the Form in order to marshal the call on the main UI thread.

    also how would i increase a public variable from multiple threads in the same time?

    Use the Interlocked.Increment method.

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

Sidebar

Related Questions

I want to update a single datarow in a datatable using multiple threads. Is
First off I want to say that I am not using threads or multiple
I am sharing some data across multiple processes by using shared memory; I use
I have some code using Rx, called from multiple threads that does: subject.OnNext(value); //
I am using multiple threads in my application using while(true) loop and now i
I'm using multiple threads in my application. Basically I have a combo box and
I am using log4net in a class with multiple threads and I had a
I'm using Posix Message Queues on Linux. Basically, I have multiple threads that receive
I want to write a server using a pool of worker threads and an
I'm studying Android process management and I'm wondering whether apps using multiple processes (not

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.