In VB6, if a listbox containing alphanumeric data has focus and a character key is pressed, the first element in the listbox starting with that character is highlighted. If multiple characters are pressed, the first element starting with each character is selected after each character press. Typing M-A-R-T will select the first M-word, then the first A-word, etc.
What I want to do is write an algorithm that dynamically searches the listbox using a multiple character string. So typing M-A-R-T will highlight the first element beginning with M-A-R-T. The "Sorted" property already does this, but my listboxes are in a wrapper that uses a custom sorting method that gets broken if Sorted is turned on.
I've written all the code to search the listbox and it works correctly, except that the default search behavior is still happening. When I press M, the first M word is highlighted. Then I press A, and the first A word is highlighted. When I release A, the first M-A word is highlighted. Then I press R, and the first R word is highlighted. Then I release R and the first M-A-R word is highlighted. So the behavior is what I want, except there is an extra search being done somewhere between the Keydown and Keyup events.
Is there a way to disable or mask the default listbox searching behavior? Or a way to lock the scrollbar so the system can't scroll it?