Solved

drop-down combo box

Posted on 1998-08-30
4
244 Views
Last Modified: 2012-05-04
How can I add a typomatic feature to a drop-down combo box?
0
Comment
Question by:gcassel
  • 2
4 Comments
 
LVL 4

Expert Comment

by:mcix
ID: 1431936
What does typomatic mean?
0
 
LVL 9

Accepted Solution

by:
Dalin earned 100 total points
ID: 1431937
gcassel,
Try this code. Let me know if this is not what you want.
Regards
Dalin

'In the form's General Declaration area, add:
Declare Function SendMessage Lib "User32" Alias _
  "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _
  ByVal wParam As Long, lParam As Any) As Long

Const CB_ERR = -1
Const CB_FINDSTRING = &H14C

'Add the sub

Sub sMatchEntry(cbo As ComboBox, KeyAscii As Integer)
  Dim sBuffer As String
  Dim lRetVal As Long

  sBuffer = Left(cbo.Text, cbo.SelStart) & Chr(KeyAscii)
  lRetVal = SendMessage((cbo.hWnd), CB_FINDSTRING, _
  -1, ByVal sBuffer)
  If lRetVal <> CB_ERR Then
    With cbo
      .ListIndex = lRetVal
      .Text = .List(lRetVal)
      .SelStart = Len(sBuffer)
      .SelLength = Len(.Text)
    End With
    KeyAscii = 0
  End If
End Sub

' in the KeyPress Event add:

Private Sub Combo1_KeyPress(KeyAscii As Integer)
  sMatchEntry Combo1, KeyAscii
End Sub
0
 

Author Comment

by:gcassel
ID: 1431938
Dalin,
   Thanks. I tried the code but no matter what letter I type I get no response.  I can still though select by clicking on the down arrow and selecting from the drop-down combo box list.  I  however want to be able to use the typomatic feature since my list is rather large.  Any other suggestions on what I might be doing wrong.
Thanks,
Gary
0
 

Author Comment

by:gcassel
ID: 1431939
Dalin,
In looking at the code further each time I enter a key SendMessage returns -1
lRetVal=SendMessage((cbo.hwnd),CB_FINDSTRING, -1, ByVal sBuffer)
  -1                  740          332                     "k"


0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA error replacing data 6 40
JSON Response and request in VB6 application 11 424
MS Date Picker 64 bit 32 bit issue 12 55
Create Files based on Cell Values in a Range in Excel 12 40
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question