I'm changing a bunch of combo boxes to autofill (typing "a" brings the list to "a", typing "ab" brings the list to "ab", etc.). It was easy enough by setting the combox box style to DropDown list and sorted = true. I put it in place for all the combo boxes in the project until I hit one where there is logic in the combo box click event. Mutiple letters can't be keyed in because each one hits the click event logic. So what I did is take the click event logic and moved it to lost focus. That got me the autofill but when another control is clicked (a check box in my case) the lost focus logic fires but it never returns to the click event. Any ideas on how I can do it? I tried using the validate event and cancel but then focus remains on the combo box. To get an idea of what I'm talking about do this:
1. Start a new VB 6.0 project.
2. Add a text box Text1 and make the tabindex 0.
3. Add a check box called Check1.
Plug in this logic.
4. Run the project.
When you click on the check box the lost focus logic will fire but never return to the click event. I'm not locked into what I'm trying. It seemed logical at the time.
To sum up the behavior in the project:
1. The combo box needs to be able to autofill\position when keying in letters:
2. When moving off the combo box a bunch of logic needs to occur to fill in the screen with the data associated with the selection.
3. What ever was clicked that lost the focus on the combo box needs to fire (check boxes, command buttons, etc)
1. Start a new VB 6.0 project.
2. Add a text box Text1 and make the tabindex 0.
3. Add a check box called Check1.
Plug in this logic.
Code:
Private Sub Check1_Click()
MsgBox "Click"
End Sub
Private Sub Text1_LostFocus()
MsgBox "lost focus"
DoEvents
End Sub
When you click on the check box the lost focus logic will fire but never return to the click event. I'm not locked into what I'm trying. It seemed logical at the time.
To sum up the behavior in the project:
1. The combo box needs to be able to autofill\position when keying in letters:
2. When moving off the combo box a bunch of logic needs to occur to fill in the screen with the data associated with the selection.
3. What ever was clicked that lost the focus on the combo box needs to fire (check boxes, command buttons, etc)