tags:

views:

51

answers:

1

I am writing a program, a crystal report program.

I got 2 listboxes in the program. 1 is for the question and 1 is for staff names.

I can search by alphabetics for question listbox.

Means there are 4 items in the listbox namely 1,2,3,4.

if i press "1" on the keyboard, selected index will change to 1.

Question listbox is single selection box.

staffname listbox is multi selection box.

for stffname listbox, the search function is not working.

means it will not changed the selected index to which i press on the keyboard.

I thought it can select and deselect by pressing keys on the keyboard.

For eg, there are 2 names, Jacky and Martin.

when i press "j" on the keyboard for the first time, jacky will be selected and when I press for second time, Jacky will be deselected.

Apparently it is not working. Any Idea?

I thought it is a built in function.

Do i need to add in myself?

+1  A: 

If you have SelectionMode property of your list box set to MultiExtended (not MultiSimple), then you should get that search-selection functionality (except for deselection, which doesn't work in One selection mode either). What's interesting is that with SHIFT key pressed you get multiple selection after pressing a letter key, but the trick doesn't work with CTRL.

Or maybe your staffname listbox just doesn't get the focus (you should click it or any item within it).