Hello!
I have a Picturebox array and a Card object array which has images inside.
I wanted to do a for loop to change the Picturebox images when clicked.
But when using my for-loop, it returns index out of bounds, even when the arrays are identical in size.

for (int i = 0; i < picturebox.Length; i++) 
{
	picturebox[i].Click += delegate(object s, EventArgs e2)
	{
		picturebox[i].Image = CardArray[i].Front;
	};
}

When your Click event fires, what value does i have?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.