2 Replies - 587 Views - Last Post: 27 November 2012 - 10:08 PM Rate Topic: -----

#1 bvmail  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 26-November 12

Add event for element created programmatically

Posted 26 November 2012 - 09:00 PM

Hey guys,
I can't find the answer for this ANYwhere.
I have created an element using the code below.
I would like to add events to PictureBox2, which was the one I created programmatically above. I would like to add like mousedown and mouseup events to it. Anybody know the answer off the top of their head?

Thanks,
Brian

PS Heres the code I used to create the element.
Private Sub Button1_Click
Dim PictureBox As New PictureBox
PictureBox.Name = "PictureBox2"
PictureBox.Location = New Point(Cursor.Position.X - 300, Cursor.Position.Y - 210)
Me.Controls.Add(PictureBox)
PictureBox.ImageLocation = "C:\image.jpg"
End Sub



Is This A Good Question/Topic? 0
  • +

Replies To: Add event for element created programmatically

#2 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 300
  • View blog
  • Posts: 1,773
  • Joined: 26-March 09

Re: Add event for element created programmatically

Posted 27 November 2012 - 02:05 AM

Have a read of this and see if it helps.
Was This Post Helpful? 0
  • +
  • -

#3 bvmail  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 26-November 12

Re: Add event for element created programmatically

Posted 27 November 2012 - 10:08 PM

View Postmaj3091, on 27 November 2012 - 02:05 AM, said:

Have a read of this and see if it helps.


thanks! thats exactly what i was looking for! stupid google jumped right over that, i guess. :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1