Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can i cancel a mouse click?

Status
Not open for further replies.

Blitz

Technical User
Jul 7, 2000
171
US
Private Sub TextBox1_MouseDown(ByVal sender As System.Object, ByVal e As MouseEventArgs) Handles TextBox1.MouseDown
Select Case e.Button

Case MouseButtons.Left

Me.TextBox1.SelectAll()


End Select

End Sub

What i would like to do is cancel the click after me.textbox1.selectall, for keydown you can do e.handled but for the mouse click that does not work. Thanks for any help.
 
Because the DoubleClick event of the ListView does not provide any mouse information, you will need to catch the mouse button prior to the DoubleClick event firing:

Private bRight As Boolean

Private Sub ListView1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseDown

bRight = Convert.ToBoolean(e.Button = MouseButtons.Right)

End Sub

Private Sub ListView1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.DoubleClick

If bRight Then Exit Sub

MessageBox.Show("Double click fired with left mouse button!")

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top