Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

search in combo

Posted on 1999-08-02
2
Medium Priority
?
203 Views
Last Modified: 2010-04-30
I have combo box. Style-DropDown list.
When I press the letter, I get first item in combo wich starts with this letter. But List of items is really big, and I want to allow user to select item by typing in multiple letters.
0
Comment
Question by:monax
[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 Comments
 
LVL 2

Accepted Solution

by:
taplin earned 200 total points
ID: 1529045
Below is a routine that I have not yet incorporated into a class (where it would be best reused!).  I created this a while ago, and use it in almost every program I write.  The basic idea is this:

1) After populating the combo or list or whatever list source you have, call the CreateIntellisense routine.  It will concatenate all possibilities into a string.

2) In the Change event of the combo box (or text box, etc.), place the code in in the cboDataType_Change() stub.

Change any reference to cboDataType to whatever the name of your ComboBox is.  Good luck.


Private strIntelliSense As String
Private blnBackSpace As Boolean

Private Sub cboDataType_Change()
    Dim intSelStart As Integer
    Dim intInstr As Integer
    Static intInside As Integer
   
    intInside = intInside + 1 'Stop recursive calls
    If intInside = 1 And blnBackSpace = False And cboDataType.Text <> "" Then
        intInstr = InStr(UCase(strIntelliSense), "{" & UCase(Left(Me.cboDataType, Me.cboDataType.SelStart)))
        If intInstr Then
            intSelStart = Me.cboDataType.SelStart
            Me.cboDataType.Text = Mid(strIntelliSense, intInstr + 1, InStr(Mid(strIntelliSense, intInstr), "}") - 2)
            Me.cboDataType.SelStart = intSelStart
            Me.cboDataType.SelLength = Len(Me.cboDataType.Text) - intSelStart
        End If
    End If
    blnBackSpace = False
    intInside = intInside - 1
End Sub



Private Sub CreateIntellisense()
    Dim intCounter As Integer
    strIntelliSense = ""
    For intCounter = 0 To cboDataType.ListCount - 1
        strIntelliSense = strIntelliSense & "{" & Me.cboDataType.List(intCounter) & "}"
    Next
End Sub


0
 

Author Comment

by:monax
ID: 1529046
Thank you taplin, it's working fine.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

715 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