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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cancel Mouse Down Event

Status
Not open for further replies.

jerasi

Programmer
Jun 19, 2000
141
CA
I have a list view of customers and I'de like to cancel the MouseDown event if the user clicked on the empty area of the ListView (not on a list item).
Private Sub lstCompanies_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lstCompanies.MouseDown
If user clicked on empty erea then
'Cancel Event
End if
End Sub

How do I get "Cancel Event" part to work?

Thank you.
 
it's not that your going to cancel the event you just don't want code to run in the area is empty.

Private Sub lstCompanies_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lstCompanies.MouseDown
If Not user clicked on empty erea then
'all code here
End if
End Sub


you could also do an exit sub I suppose. I don't really like them though it seems well brutal and unelegant. That'l do donkey, that'l do
[bravo] Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top