VB6 DataCombo Box Matching

I'm using VB 6.0, and a bound (ADO) DataCombo control.  I need some help with the matching.  What I would like it to do is:

1. when the user type some characters in the datacombo box, the drop down list will be shown and the matched item will be highlighted.

2. The highlighted item will be the first one in the drop down list.

For the standard Combo Box, I can just use some API calls, like
SendMessage((CB.hwnd), CB_FINDSTRING, -1, ....)

But all these API calls do not work with the DataCombo box. Also, DataCombo don't have the "ListIndex" property as originally Combo box do.

Can anybody give me some suggestions and examples?




KChanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

KChanAuthor Commented:
Edited text of question.
0
Bob LearnedCommented:
What is the setting for MatchEntry in the DataCombo?  You might want to set this to 1 - dblExtendedMatching.  This will move to new rows based on the characters pressed by the user (Not just one character).
0
KChanAuthor Commented:
Here was my Datacombo setting
     style 0-dbcDropDown
     MatchEntry  1-dblExtended Matching

The DBCombo only move the matched item to a new row.
How can I put the matched item to the DBcombo.text property after the user press "Return" Key and she don't need to type all the characters as the matched item?


0
Bob LearnedCommented:
It took me a while, but you might try this:

Private mbEnterKey As Boolean

Private Sub DataCombo1_KeyDown(KeyCode As Integer, Shift As Integer)

Dim lLength As Long
Dim lRtn As Long
Dim sText As String

   If KeyCode = vbKeyReturn And Not mbEnterKey Then
      mbEnterKey = True
      KeyCode = 0
      SendKeys "{Down}", True
      SendKeys "{Enter}", True
   End If

End Sub

Private Sub DataCombo1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)

   mbEnterKey = False
   
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KChanAuthor Commented:
Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.