Solved

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

Posted on 1998-07-28
3
167 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

749 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