リストボックスの最後の項目の後に最初の項目に移動するように、このループを継続させることはできますか?
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
BackgroundWorker worker = sender as BackgroundWorker;
for (int i = listBox1.Items.Count - 1; i >= 0; i--)
{
{
if (worker.CancellationPending == true)
{
e.Cancel = true;
break;
}
else
{
string queryhere = listBox1.Items[i].ToString();
this.SetTextappend("" + queryhere + "\n");
System.Threading.Thread.Sleep(500);
worker.ReportProgress(i * 1);
}
}
}
}
どんな助けでも大歓迎です!
すべての答えをありがとう
私のリストは逆行していたようですので、交換する必要があります
for (int i = listBox1.Items.Count - 1; i >= 0; i--)
と
for (int i=0;i<ListBox1.Items.Count;i++)