Handling Mouse Events

  • You can handle mouse events- such as mouse movements- in forms and controls
  • In the example few of the mouse movements in a form and the movement status is displayed in the text box shown in Fig 4, Fig. 5 and Fig 6.
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
If e.Button = Windows.Forms.MouseButtons.Left Then
TextBox1.Text = "mouse down at " + CStr(e.X) + "," + CStr(e.Y)
End If
End Sub
Private Sub Form1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.MouseEnter
TextBox1.Text = "Mouse Entered"
End Sub
Private Sub Form1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.MouseLeave
TextBox1.Text = "Mouse left"
End Sub
End Class




Performing Data Validation<< Previous

Next >>Keyoard Event

Our aim is to provide information to the knowledge


comments powered by Disqus
Footer1