I am working on an application that searches the files in the directory provided using background worker... the problem is with the backgroundWorker1.RunWorkerAsync();
following is my code when i am trying to give multiple paths for searching the file i type in the textbox
private void toolStripTextBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyValue == 13)
{
foreach (string s in listBox1.Items)
{
DirectoryInfo deer = new DirectoryInfo(s);
toolStripButton2.Visible = true;
//listView1.Items.Clear();
if (!backgroundWorker1.IsBusy)
{
backgroundWorker1.RunWorkerAsync(deer);
}
else
MessageBox.Show("Can't run the worker twice!");
// backgroundWorker1.RunWorkerAsync(deer);
}
}
listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
}
and i get the following error
This BackgroundWorker is currently busy and cannot run multiple tasks concurrently. please help me out..