title: How can I get rid of this error? Visual Basic 2010
body: <p>I have an array of pictureboxes, like this (they all have an image displayed on them, from the designer, from my.resources):</p>
  
  <pre><code>Dim imgSourcePic() As PictureBox = {imgAcronym, imgAcrostic, imgAdjective, imgAdverb, imgAlliteration, imgApostrophe, imgClause, imgComma, imgDialogue}
  </code></pre>
  
  <p>and another array of pictureboxes (which don't have an image displayed, yet):</p>
  
  <pre><code> Dim imgDefinitiontoMatch() As PictureBox = {imgDefinition1, imgDefinition2, imgDefinition3, imgDefinition4, imgDefinition5}
  </code></pre>
  
  <p>In the sub NewGame() I have a line of code which is:</p>
  
  <pre><code>imgDefinitiontoMatch(intX).Image = imgSourcePic(intRandomNumber).Image
  </code></pre>
  
  <p>But, whenever it executes this line of code I get this error:</p>
  
  <p><img src="https://i.stack.imgur.com/cwoNF.png" alt="enter image description here"></p>
  
  <p>I debugged it and saw that the pictureboxes, in the array, are displaying the Image property as 'Nothing'.</p>
  
  <p><img src="https://i.stack.imgur.com/Mtr8e.png" alt="enter image description here"></p>
  
  <p>How else can I assign an image to the pictureboxes in imgSourcePic() that'll work? </p>
  
  <p>I have tried creating variables for all of the images, such as:</p>
  
  <pre><code>Dim picAcronym As Image = My.Resources.Acronymn_definition
  ...
  </code></pre>
  
  <p>But still doesn't achieve anything.</p>
  
  <p>I hope this isn't a duplicate, but I have been trying to figure it out all day and can't seem to make
  it work :(</p>
  
  <p>Many thanks and, as always, hope this makes sense.</p>