[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1490
  • Last Modified:

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?




0
KChan
Asked:
KChan
  • 3
  • 2
1 Solution
 
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
 
KChanAuthor Commented:
Thank you.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now