I might be way off base here but this code on the MS site doesn’t work for me when I modified it a little. Sorry its almost 2am. What variable should the int be? The program crashes stating “Specified cast is not valid.”
ArrayList OddEven = new ArrayList();
foreach (int i in lbList.Items)
OddEven.Add(i);
foreach (int i in OddEven)
{
if (i % 2 == 0)
lbEven.Items.Add(i);
else
lbOdd.Items.Add(i);
}
lbList.Itemsare probablystringsand an implicit cast tointdoesn’t exist.Try this: