Hey guys!
I have a question. I have this code:
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
int count = listView1.Items.Count;
int threads = 5;
LinkChecker[] lc = new LinkChecker[count];
int trace = 0;
for (int i = 0; i < count; i++)
{
for (int k = 0; k < threads; k++)
{
lc[k] = new LinkChecker(this);
ThreadPool.QueueUserWorkItem(new WaitCallback(lc[k].DoChecking), trace);
}
}
}
and
delegate void DelegateDoChecking(object sender, int id);
public void DoChecking(object sender, int id)
{
if (form1.listView1.InvokeRequired)
{
DelegateDoChecking del = new DelegateDoChecking(DoChecking);
object[] items = { sender, id };
form1.listView1.Invoke(del, items);
return;
}
string url = form1.listView1.Items[id].Text;
if (CheckLink(url))
{
string a = anchor;
form1.listView1.Items[id].SubItems.Add("Found");
form1.listView1.Items[id].SubItems.Add(a);
form1.listView1.Items[id].BackColor = Color.FromArgb(237, 252, 211);
}
else
{
form1.listView1.Items[id].SubItems.Add("Not Found");
form1.listView1.Items[id].BackColor = Color.FromArgb(253, 231, 231);
}
}
But that threadpool says that there's no overload for DoChecking.
Anybody knows what should I fix ?