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

button double click

Status
Not open for further replies.

slybitz

Technical User
Mar 25, 2005
113
US
ok this really seems like a simple problem but i cannot figure it out for the life of me. when i add a button to my form i want to be able to double click that button and have it perform an action. but for some reason i can not enter into the doubleclick handle when i double click on the button. for example when i double click on the button i would expect the below code to work but it does not. any ideas?

-------------
Private Sub btnWTF_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnWTF.DoubleClick

MsgBox("hello world")

End Sub
-------------
 
Why don't you just use the Click event? Buttons are made for single clicks. That's how Windows works. If you really want a double-click event, you can use a label.
 
According to help for the Button.DoubleClick event:
By default, the ControlStyles.StandardClick and ControlStyles.StandardDoubleClick style bits are set to false for the Button control, and the DoubleClick event is not raised.
 
From your other thread:
when i click once on the button it will remove the selected item from the listbox. when i double click i want to remove all items from the listbox.

I would consider using separate buttons for remove selected/remove all, or just allowing the user to multi-select in the list box.
 
i just added a clear all button. thanks.
 
i just added a clear all button.
To keep this in one thread. That is the best way to do it. Also your delete should be a button as well. You are likely to run into unwanted deletes if you delete on click.

-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top