   rectangle won't draw onClick (VB 2008)
  I've got a pictureBox control on my form that when I click it, it should draw a rectangle in the top left corner.  I'm not really sure why it isn't working.Private Sub tileSet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tileSet.Click   Dim g As Graphics = Graphics.FromImage(tileSet.Image)   g.DrawRectangle(Pens.Red, 0, 0, 16, 16)    End SubThe event is firing as I've checked it with a message box.  What confuses me is that this same code works on the form1_Load sub.  It doesn't crash or anything, it just..doesn't draw anything.  None of the drawing functions are working there.   
  You should not draw outside the Paint-handler. The next time the paint handler is called normally your rectangle is gone.You should set a flag, call invalidate and draw the rectangle during the normal paint processing.   ;  I see..I set up the paint handler and it all works now.  Thanks!   