JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Handling Button Releases

You can tell when a button has been pushed using its Click event, but can you tell when it's been released? Yes, by using the MouseUp event. In fact, buttons support the MouseDown, MouseMove, MouseUp, KeyDown, KeyPress, and KeyUp events.

To determine when a button has been released, you can just use its MouseUp event this way:

Private Sub Button1_MouseUp(ByVal sender As Object, _
    ByVal e As System.Windows.Forms.MouseEventArgs) _
    Handles Button1.MouseUp
    TextBox1.Text = "The button went up."
End Sub

This can be useful if you want the user to complete some action that has two parts. For example, you can use MouseDown to start a setting of some kind changing in real time—giving the user interactive visual feedback, and MouseUp to freeze the setting when the user releases the button.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor