I have a method that fires after a button click. Inside that method, it loads my list of users, once that is done, I want to determine whether each user is enabled or disabled, but I want that to be done in the background.
I am using the ThreadPool class for this, but when it get's to that part, it does it like it's single threaded...any help.
Here's a code snippet
if (lbList1.Items.Count > 0)
{
for (int x = 0; x < lbList1.Items.Count; x++)
{
tInfo = new ThreadInfoClass(lbList1.Items[x].ToString(), tbSourceDC.Text.ToString(), x);
ThreadPool.QueueUserWorkItem(new WaitCallback(LoadAllStatus1), tInfo);
Application.DoEvents();
}
}
I am using the ThreadPool class for this, but when it get's to that part, it does it like it's single threaded...any help.
Here's a code snippet
if (lbList1.Items.Count > 0)
{
for (int x = 0; x < lbList1.Items.Count; x++)
{
tInfo = new ThreadInfoClass(lbList1.Items[x].ToString(), tbSourceDC.Text.ToString(), x);
ThreadPool.QueueUserWorkItem(new WaitCallback(LoadAllStatus1), tInfo);
Application.DoEvents();
}
}