title: How to change the image displayed on a button at runtime in Visual Basic?
body: <p>I am trying to change the Image attribute associated with a button when the button is clicked.
  I have added the image I want to display (called &quot;Black Pawn.png&quot;) as a resource within the solution and (from searching around and looking at similar questions) am trying to set the image attribute to it as shown below:</p>
  <pre><code>Private Sub boardButtonA2_Click(sender As Object, e As EventArgs) Handles boardButtonA2.Click
          Dim sprites As Object = My.Resources.ResourceManager
          boardButtonA2.Image = sprites.GetObject(&quot;Black Pawn.png&quot;)
      End Sub
  </code></pre>
  <p>But when I click the button, the default image on it just disappears and is replaced with nothing instead of Black Pawn.png.</p>
  <p>I am pretty new to using Visual Basic and Visual Studio so I may have failed to have added the image as a resource properly but I can see the image in the Solution Explorer above the form the button is in.</p>
  <p>Any help or advice would be a great help.
  Thanks.</p>