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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:48:16+00:00 2026-06-10T05:48:16+00:00

an architectural question here. I have a List (selected via a listview) that needs

  • 0

an architectural question here.

I have a List (selected via a listview) that needs to be sent to a webservice and created in the database. I want to be able to update one at a time then update a progress bar, listview and local List with the returned ID without locking up the uithread (although i’ll have lock the listview/search controls etc they just need to be able to complete other task in different forms).

At the minute i’ve considered the following (new to most)

Background worker – the only problem here is that the progressChanged only returns an int so i’d find it difficult to return all the information I need.

Tasks – i’m using these at the minute when all I need to return a single object and then process that information (like getting list from local database and then populating listview and that works well). I can’t figure out how to spawn a thread that in turn does a loop and updates the UI Thread at the end of each pass.

parallel.foreach – don’t think this would be suitable with the web services element.

All the stuff i’ve tried so far, either locks the UI or gets cross thread exceptions.

I guess i’m looking for something that allows me to do this

createUsers(ref List<users> _users)
{
    foreach(user _u in _users)
    {
        //call webservice and update - it returns an ID or null
        string newID = webCreate(_u);
        if (newID != null)
        {
            ListViewItem lvi = listview1.FindText(_u.ListID);
            lvi.SubItems[5].Text = newID;
            _u.newID = newID;
        }
        else
        {
            lvi.SubItems[5].Text = "Error";
        }
        progressbar.value++
    }
}

There just seems to be so many options in .net 4.0 for threading I just can’t think which one will best serve me. Any pointers would be great.

Thanks, Pete.

  • 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-10T05:48:17+00:00Added an answer on June 10, 2026 at 5:48 am

    If your create users is run in a separate thread. Have your form, have an updatestatusbar

    delegate void updStatusbar(int i);
    public UpdateStatusBar(int i)
    {
      if (Statusbar1.InvokeRequred)
      {
        updStatusbar c = UpdateStatusBar;
        this.Invoke(c,new object[] {i});
      }
      else
        Statusbar1.value=i;
      }
    }
    

    Now you can call updatestatusbar from anywhere, thread or otherwise and it sorts itself out.

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

Sidebar

Related Questions

I have an architectural question on handling message ordering. For purposes of this question,
I have a noob question here. I'm getting my head around the C++ structure
I don't think the question is clear here. Simply I have 19 types of
New to DDD here and have a architecture question which should be a typical
I have an architectural nightmare lying before me and want to clear some details.
So I have, what would seem like a common question that I can't seem
I don't have a specific question here but I'm more looking for some guidance
having a little architectural trouble here. In C++, we have the notion of 'friends,'
This question is a continuation of my previous question here zend models architecture (big
er,here is a question about netty nioWorker Netty architecture - questions about NioWorker loop

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.