Solved

This is for Dalin - re VB Q.10052471 on 5/12/98

Posted on 1998-07-28
3
163 Views
Last Modified: 2010-05-18
Dalin,

Back in May (5/12/98) you offered to email an Experts-Exchange user some code for an "Enhanced Combo Box" (re VB Q.10052471).

I need to use something similar... have a combo box jump to the most appropriate item in the list as I type, and was hoping you would be able to email the code for the combo box to me as well.

I'd be very appreciative.  Please let me know.

-- Stacey --

email:  s033slb@discover.wright.edu


0
Comment
Question by:s033slb
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
Dalin earned 10 total points
ID: 1467024
s033sld,
Look for your e-mail
Regards
Dalin
0
 
LVL 9

Expert Comment

by:Dalin
ID: 1467025
I got a returned e-mail.

here is the code:
'Declare
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:s033slb
ID: 1467026
Thanks Dalin,

I'll give a try tomorrow at work.

-- Stacey --

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.

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

856 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