title: How do you load an image from resource file in vb 2010 expresss?
body: <p>First of all Im new to vb 2010 and so far have enjoyed what I have been able to do with it. That being said I have run into an issue with my current project. </p>
  
  <p>Basically I have created a timer and all works well on that part. My issue lies in that my timer loads a .png for each minute/second and I was linking the images like so:</p>
  
  <pre><code>Picturebox1.Image = Image.Fromfile("C:\timer\images\" &amp; minutes.text &amp; ".png")
  Picturebox2.Image = Image.Fromfile("C:\timer\images\" &amp; seconds.text &amp; ".png")
  </code></pre>
  
  <p>So running this on another pc rendered that bit of code useless as that computer did not have those files locally and the program would end in an error as it could not find the .png files.</p>
  
  <p>I did a bit of searching online and found a few sites and video tutorials how to read from the resource file. But in doing so I have been unable to make it function properly.</p>
  
  <p>So this is what I found here:</p>
  
  <pre><code>Picturebox1.image = My.Resources.minutes.text
  Picturebox2.image = My.Resources.seconds.text
  </code></pre>
  
  <p>I know this bit of code is wrong as I'm now getting 2 errors in vb 2010. The only way I have managed to make this work is to specify the file name. But what I'm wanting to do is use whats in "minutes.text" and "seconds.text" to specify the file name.</p>
  
  <p>Is there a way around this? or do I have to use a bunch of if statements to do this?</p>
  
  <p>example:</p>
  
  <pre><code>If minutes.text = 1 Then
  picturebox1 = My.Resource._1
  End If
  If seconds.text = 12 Then
  Picturebox2 = My.Resource._12
  End If
  </code></pre>
  
  <p>I would hate having to do a bunch of if statements if there is a simple fix. So I've come here for help. </p>