Windows Develop Bookmark and Share   
 index > Windows Forms Designer > getting the mouse double click to work for a combo box
 

getting the mouse double click to work for a combo box

Has anyone out there gotten the mouse double click to work in the combo box? The property is there and you can create an event handler but it seemingly not used by the combo box. Has anyone created a custom control that has this implemented and working? I really liked this feature in Access VBA. There, the double click event does work? Any help on this, would be appreciated. Thank you. I am using VS 2005 and using both VB and C# .NET.

Ed Cohen | enc0hen@comcast.net


Edgar Cohen  Wednesday, November 19, 2008 12:49 AM

Hi Edgar Cohen

The ComboBox does not provide a DoubleClick event like other controls do. If you need to handle this event in ComboBox, you can override the WndProc method to capture the WM_LBUTTONDBLCLK Win message. Please look at this.

http://bytes.com/archives/net-c/536478-combobox-mousedoubleclick-event-never-fires

Please tell me if you have any question about it.

Sincerely,

Kira Qian

Kira Qian  Monday, November 24, 2008 2:34 AM

Hi Edgar Cohen

The ComboBox does not provide a DoubleClick event like other controls do. If you need to handle this event in ComboBox, you can override the WndProc method to capture the WM_LBUTTONDBLCLK Win message. Please look at this.

http://bytes.com/archives/net-c/536478-combobox-mousedoubleclick-event-never-fires

Please tell me if you have any question about it.

Sincerely,

Kira Qian

Kira Qian  Monday, November 24, 2008 2:34 AM
this will mimic as if a double_click was issued: (one could use the 'Stopwatch' as well)

Private Sub ComboBox1_MouseClick(ByVal sender As Object, ByVal e As _ System.Windows.Forms.MouseEventArgs) Handles ComboBox1.MouseClick

Static prevClick As DateTime = DateTime.Now

'as mousedoubleclick doesn't work, detect 2 clicks within a defined time-laps to mimic

'here use 500 millisecondsbetween clicks
If
DateTime.Now.AddMilliseconds(-500) < prevClick Then

'do what you expect the double_click to do
'....

End If

'set the reference for the next click
prevClick = DateTime.Now

End Sub

  • Proposed As Answer bydibidibi Tuesday, December 30, 2008 12:50 PM
  •  
dibidibi  Tuesday, December 30, 2008 12:46 PM
Hi Kira,

This is a rediculous situation! People were complaining about this not working back in VS2005.

Now, using VS2008, I find the problem *still* exists. Even worse, SP1 has not fixed this problem either!

This isan unbelievable oversight, & I am at a complete loss as to why 3 versions later this problem still hasn't been addressed.

It's not like it's some weird kind of thing that very few people will want to do, it's a fundamental event that it seems *all* windows forms controls can handle, *except* the combobox.

It's not good enough!

Yann
Yann Duran  Sunday, February 01, 2009 3:29 PM
I'm using C# in VS2008.
A very important point, that I have worked out by trial and error, is that a ComboBox's MouseDoubleClick eventnever gets through to a user event handler.
The MouseClick event usage described by "dibidibi" only works if the ComboBox has a DropDownStyle property of "DropDown" (at least it certainly doesn't work if the DropDownStyle is "DropDownList"), and I found that the only practical way to get it to work is if you double-click in the "edit box", not in the dropped-down list - you can also setthe "AutoCompleteMode" to "SuggestAppend" with AutoCompleteSource set to "ListItems" if that suits your needs.
John Line  Thursday, March 26, 2009 12:18 PM

You can use google to search for other answers

Custom Search

More Threads

• How do I find out location of toolstrip in VB.NET 2005
• A Class That Inherits System.Messaging.MessageQueue Fails To Open In Designer
• Digital Signature Verification using Certificate data in C#.
• Changing the default click behavior for a TreeView control
• Collapsible property for custom control
• question on good programming practices
• How to act like the designer of micrsoft which creates the "InitializeComponent" method
• webbrower control
• Display a string on an AVI movie
• manual position of Form2 from Form1