Yay I finally thought of a title!
I have a foreach loop that iterates the ListViewItems and does something with each item. But the problem is not that it doesn't do the work in the loop, but it simply does not execute any code that appears before the foreach loop.
Below is the full method:
private void pNGToolStripMenuItem_Click(object sender, EventArgs e)
{
stat.Text = "Converting to PNG.";
_piclist.Enabled = false;
foreach (ListViewItem item in _piclist.Items)
{
try
{
/* magical image conversion here. */
_piclist.Enabled = true;
stat.Text =
"Conversion comlpete.";
}
catch (Exception exception)
{
stat.Text =
exception.Message;
}
}
}
Can somebody please help me understand why the code:
stat.Text = "Converting to PNG.";
_piclist.Enabled = false;
before the foreach loop never gets executed?
Thanks