Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42299

VS 2008 Pass value in events

$
0
0
Hi Guys,

I am dynamically adding controls in my form or container. I need to do something on an event.

Code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim P As New PictureBox
        P.BackColor = Color.Wheat
        Me.Controls.Add(P)
        P.Show()
        P.Tag = Now.Date
        AddHandler P.MouseMove, AddressOf MMove
End Sub

 Public Sub MMove(ByVal sender As Object, ByVal e As EventArgs)
        ' here i want value / tag of picturebox
  End Sub

Basically I am adding controls to my form and I want that on mousemove I can get that controls location or tag or something.

How can I achieve the same ?

Thanks,

Cheers,
GR

Viewing all articles
Browse latest Browse all 42299

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>