Simulate Pressed Control Key for Multiple Selections in List Box

Simulate Pressed Control Key for Multiple Selections in List Box

When selecting items in a normal list box with the MultiSelect property set to 1 – Simple or 2 – Extended,the user needs to press the control key while clicking on the items in order to continuously select multipleitems without also deselecting the items currently selected. This method lets the user select multiple itemscontinuously without pressing the control key. Place this code in a module:

 Declare Function GetKeyboardState Lib _        "user32" (pbKeyState As Byte) _        As LongDeclare Function SetKeyboardState Lib _        "user32" (lppbKeyState As Byte) _        As LongPublic Const VK_CONTROL = &H11Public KeyState(256) As Byte

Place this code in the MouseDown event procedure in a list box (List1) with MultiSelect property set aseither Simple or Extended:

 ' Sets the control key state to' "pressed"GetKeyboardState KeyState(0)KeyState(VK_CONTROL) = _        KeyState(VK_CONTROL) Or &H80SetKeyboardState KeyState(0) 

Place this code in any procedure where the pressed control key is to be released, such as theList1_LostFocus event procedure:

 ' release the control key state from ' "pressed"GetKeyboardState KeyState(0)KeyState(VK_CONTROL) = _        KeyState(VK_CONTROL) And &H7FSetKeyboardState KeyState(0)
Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes