[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

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

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

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
s033slb
Asked:
s033slb
  • 2
1 Solution
 
DalinCommented:
s033sld,
Look for your e-mail
Regards
Dalin
0
 
DalinCommented:
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
 
s033slbAuthor Commented:
Thanks Dalin,

I'll give a try tomorrow at work.

-- Stacey --

0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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