How to run same code in click event as the double click event?

后端 未结 3 625
小蘑菇
小蘑菇 2021-01-25 08:11

I have 4 items in a ListBox and each item does a specific thing when it gets clicked on.

But I also want the double click event to do the same thing as the click event.<

3条回答
  •  野性不改
    2021-01-25 08:44

    Same routine can handle both events. Code:

    Private Sub ListBox1_AllClicks(
         ByVal sender As Object, ByVal e As System.EventArgs) 
        Handles ListBox1.Click, ListBox1.DoubleClick
    

    You can set this up in the listbox properties: view events and use the dropdown next to DoubleClick to choose an existing routine.

提交回复
热议问题