I have this simple code that I'm trying to parallelize:
Parallel.For (0,countimages, i => { picbox[i] = new PictureBox(); picbox[i].Image = image; TableLayoutPanel1.Controls.Add(picbox[i], column, row); column+=1; }); and I get this error:
ParallelFor | Cross-thread operation not valid: Control TableLayoutPanel1 accessed from a thread other than the thread it was created on.
What am I doing wrong?