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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:07:51+00:00 2026-06-02T19:07:51+00:00

I have a program that does thorough computations for millions of records. Sometimes, it

  • 0

I have a program that does thorough computations for millions of records. Sometimes, it runs for more than an hour, sometimes about 30 minutes. During that time the program is not responding or un-clickable. Is there any workaround for this? Like, the loading mouse icon.

Another problem is that if I make two dictionaries as a datasource of datagrid, it’s very slow compared to reading a csv file and putting it in to datagrid. Here’s the algo:

for i = 0 to last record
    datarow row = new datarow
    put i to row[0]
    put names[i] to row[1]
    put comments[i] to row[2]
    add row to datatable
end for loop
datatable.acceptchanges()
datagridview.datasource = datatable

Note: names[i] and comments[i] are dictionaries. However, if i just read from a csv file with almost the same loop and put it into datatable and make it as datasource of datagridview, it’s faster (about 5-10 minutes compared to 20 minutes of dictionaries). Is there any workaround for that?

  • 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-02T19:07:52+00:00Added an answer on June 2, 2026 at 7:07 pm

    I’d use a task to run this in the background. Then your UI thread won’t be locked up while the task is running.

     var task = new Task(() =>
     {
      for i = 0 to last record
         datarow row = new datarow
         put i to row[0]
         put names[i] to row[1]
         put comments[i] to row[2]
         add row to datatable
      end for loop
      datatable.acceptchanges()
     });
    
     // Start the task.
     task.Start();
    
     task.ContinueWith(t =>
     {
        datagridview.datasource = datatable
     }, TaskScheduler.FromCurrentSynchronizationContext());
    

    You’ll need to assign the datasource in the UI thread or you’ll get an exception. That is what the TaskScheduler bit will do for you. When the task is done, your continuation will run on the UI thread (Assuming you set the continuation from the UI thread).

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

Sidebar

Related Questions

I have a program that does recursive calls for 2 billion times and the
We have a table with a CreateDateTime PK. The program that does the inserts
I have a C/ncurses program that I'm debugging/maintaining. This program does ripoffline twice: first,
We have a program with a main() that parses certain CLPs but does not
I have a Python program (with Django - does this matter?) that I want
I have program that runs fast enough. I want to see the number of
I have a program that uses the GPU for performing certain computations. I can
For about a year I have been thinking about writing a program that writes
i have a program(winform) that runs through a lot of files(in the area of
So I have a program that makes char* stuff lowercase. It does it by

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.