title: Unable to cast object of type 'System.Windows.Forms.Button' to type 'System.Windows.Forms.PictureBox'
body: <p>I am trying to perform the same operation on multiple pictureboxes but the first line of the following code is generating this error:</p>
  
  <pre><code>Unable to cast object of type System.Windows.Forms.Button to type System.Windows.Forms.PictureBox
  </code></pre>
  
  <p>So I was wondering if anyone could be of assistance. Thanks in advance.</p>
  
  <pre><code>For Each pb As PictureBox In Me.Controls
      Dim bp As New Bitmap(pb.Image)
      pb.Region = GetRegion(bp, Color.FromArgb(255, 255, 0, 255))
      pb.Image = Nothing
      pb.BackColor = Color.FromArgb(100, Color.Yellow)
  Next
  </code></pre>