Hi!
My guess is that you are using a single variable to generate an array of picture boxes. So i would suggest this to work around the issue:
STEP 1. When creating picture box assigned a unique name to it. like : pic1, pic2, pic3 .... etc
e.g.,
a = New PictureBox()
counter += 1
a.Name = "a" & counter.ToString()
Me.Controls.Add(a)
AddHandler a.MouseDown, AddressOf a_MouseDown
AddHandler a.MouseMove, AddressOf a_Mousemove
AddHandler a.MouseUp, AddressOf a_Mouseup
STEP 2. Use Control.RemoveByKey() method to remove it:
Private Sub a_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
If e.Button = Windows.Forms.MouseButtons.Right Then
Me.Controls.RemoveByKey(CType(sender, PictureBox).Name)
Me.Invalidate(True)
End If
End Sub