1

I hope you all are well. I need some help in Windows Form .NET framework. I have a button with a click event, now I wanna make another event for double click, how would I do that? This is what I am trying to do -

Single-Click - MessageBox.Show("1");
Double-Click - MessageBox.Show("2");

the button is called Save

Thanks for reading :)

  • 2
    Button are not really meant to be double clicked. [MSDN](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.button.doubleclick?view=netcore-3.1) : _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._ – TaW Jul 20 '20 at 12:39
  • 2
    Does this answer your question? [WinForms how to call a Double-Click Event on a Button?](https://stackoverflow.com/questions/13486245/winforms-how-to-call-a-double-click-event-on-a-button) – default locale Jul 20 '20 at 12:41
  • Unfortunately **NO** so that's the reason I made a new question – Supreme Gang Certified Member Jul 20 '20 at 12:45
  • 2
    Actually it does, esp. the 2nd paragraph! - Preferred workaround: In the Clicked event you can test modiier keys to allow for a modified save action.. – TaW Jul 20 '20 at 12:47
  • You might have to roll your own, by counting the number of clicks recently.. and then you'll wonder why nearly no one uses your awesome double click code. It's because years of conditioning in the use of UIs has taught every computer user around the world that buttons are not something you double click. Heck, for years browsers had to stop people double clicking things with options like "detect/prevent accidental double clicks" so gradually people single click nearly everything now. What do we even double click any more? Icons maybe.. but only for Load, not save.. double click is even just.. – Caius Jard Jul 20 '20 at 13:00
  • ..an activator for single Click - drag behavior (touchpads that don't click, double tap drag to perform a single clickhold drag) – Caius Jard Jul 20 '20 at 13:04
  • In this case, you should probably tell us why exactly the old answer doesn't work for you. Have you tried to implement `DoubleClickButton`? What happened? To help you, we need to know the specific problem you're facing – default locale Jul 20 '20 at 21:18

0 Answers0