Responding to a listBox double-click

Posted on 2004-11-21
Last Modified: 2010-04-15
I assume I'm just overlooking something obvious.  I'd like to override the event which fires as a result of the user double-clicking on an item in a listbox.

Thanks for the help.

Question by:ba272
    LVL 22

    Accepted Solution


      Here's a simple example to create new ListBox control named MyListBox, and I override the doubleclick event so it show messagebox each time you double click on it,

    then add it to Toolbox, and it will be new control with your new implementation of DoublClick

    using System;
          public class MyListBox:System.Windows.Forms.ListBox
                protected override void OnDoubleClick(System.EventArgs e)  
                      // add your code here
                      System.Windows.Forms.MessageBox.Show("My Double click");


    LVL 6

    Expert Comment

    As mnasman said, If you want to override a methord in a class which is virtual, then you must drive a class from that and override that method. The purpose of this is in this concept is that, if you are going to develop a custom control or something you can do that. There are lot of examples on the web for custom listbox controls. If you weant more information, let me know.


    Author Comment

    Thanks Chester,

    But it turns out the first event listed in the Action section of the events window (associated with the Properties window) is DoubleClick.  All I needed to do was double click it and it generated the event for me.  But I like his approach and may try it with other things as well.

    Thanks for asking.


    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
    This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now