Wednesday, March 28, 2012

Trouble creating an array of a class I created

What am I doing wrong? I made a class and want to create an array of that class and I keep getting "object reference not set ot an instance of an object" when the code hits line 4. Tile is the class I made

1private void usrTurnTile_Load(object sender, EventArgs e)2{3Tile[] objTile =new Tile[20];4objTile[3].Visible =false;5}

adding this fixed it...

for (int i23 = 0; i23 < 20; i23++)

objTile[i23] =newTile();


adding this fixed it...

for (int i23 = 0; i23 < 20; i23++)

objTile[i23] =newTile();


adding this fixed it...

for (int i23 = 0; i23 < 20; i23++)

objTile[i23] =newTile();

0 comments:

Post a Comment