Click here to Skip to main content
15,921,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I have a listbox with many data. I like to click on a row and hold down shift/ctrl key and press up/down arrow to select another row(s) like we can do in excel. how can i detect shift/ctrl and arrow key pressed.

Thanks.
Posted
Updated 14-Aug-11 21:50pm
v2

1 solution

You don't have to - the ListBox will handle it for you. Just set the SelectionMode property to MultiSimple or MultiExtended and it will allow Shift and Ctrl to work.
 
Share this answer
 
Comments
samip shrestha 15-Aug-11 3:52am    
HiI tried with MultiExtended it worked ...however it did not work when set to MultiSimple..am i missing sth...what should i do to make it work even for ctrl key hold down and pressing arrow down/up.

Thanks
OriginalGriff 15-Aug-11 4:02am    
No - the CTRL key does not work that way in Windows, and it should not be subverted to do somthing different from all other applications. When you use MultiExtended (which is probably the one you want) CTRL and click adds or subtracts a single item from the list. Try it in File explorer (or excel!)
samip shrestha 15-Aug-11 4:10am    
Thanks you very much OriginalGriff.
OriginalGriff 15-Aug-11 5:35am    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900