Common Events
-
I am trying to find a simple way to apply the same event handling to multiple object. For example: I have 10 lables that need to have a cursor change to hand while the cursor is moving over the object. I would have to write the following for each lable: Private Sub Label1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.MouseHover Me.Cursor.Current = Cursors.Hand End Sub Private Sub Label1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.MouseEnter Me.Cursor.Current = Cursors.Hand End Sub Private Sub Label1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseMove Me.Cursor.Current = Cursors.Hand End Sub There's got to be a better way! Thanks
-
I am trying to find a simple way to apply the same event handling to multiple object. For example: I have 10 lables that need to have a cursor change to hand while the cursor is moving over the object. I would have to write the following for each lable: Private Sub Label1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.MouseHover Me.Cursor.Current = Cursors.Hand End Sub Private Sub Label1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.MouseEnter Me.Cursor.Current = Cursors.Hand End Sub Private Sub Label1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseMove Me.Cursor.Current = Cursors.Hand End Sub There's got to be a better way! Thanks
jboss wrote: 2roses=? 14myw-14mym :rose::rose:Theas a beta way: in vb.net, a sub can handle many similar events for controls of the same type assume u hav label1, 2,.. labeln, guess this does it Private Sub Label1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.MouseEnter, Label2.MouseEnter, Label3.MouseEnter, .. , Labeln.MouseEnter Me.Cursor.Current = Cursors.Hand End Sub Steff Kamush 2roses=? 14myw-14mym
-
jboss wrote: 2roses=? 14myw-14mym :rose::rose:Theas a beta way: in vb.net, a sub can handle many similar events for controls of the same type assume u hav label1, 2,.. labeln, guess this does it Private Sub Label1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.MouseEnter, Label2.MouseEnter, Label3.MouseEnter, .. , Labeln.MouseEnter Me.Cursor.Current = Cursors.Hand End Sub Steff Kamush 2roses=? 14myw-14mym