1
Answer

Why wont these Image Arrays assign themselves? (pulling out hair)

Todd Vance

Todd Vance

17y
1.8k
1
I have made three arrays of Images (imgPile1, 2, and 3)  and wanted to loop through them and assign them -- but for some reason it will not assign!

private void makePiles()

{

int c = 0 ; //This is the actual iterator for the 21 cards

for (int i=0; i<7; i++) // Going through this 3 times

{

imgPile1[i] = cardImages[myDeck.randomCardHand[c]];

c++;

imgPile2[i] = cardImages[myDeck.randomCardHand[c]];

c++;

imgPile3[i] = cardImages[myDeck.randomCardHand[c]];

c++;

}

}

The myDeck.randomCardHand[whatever] is a int List -- when I make a seperate statement in my program such as :

imgPile1[2] = cardImages[myDeck.randomCardHand[2]];

image4.Image = imgPile1[2];

That statement works fine - fills the array in and assigns it to the pic box just fine -- but for some reason the iteration WILL not assign the variables to the array and I do not understand why not?

Any help on what I am missing?

Answers (1)