RE: Problem with Listbox search

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Bompi (Bompi_at_discussions.microsoft.com)
Date: 02/05/05


Date: Sat, 5 Feb 2005 07:57:03 -0800

Sorry about the mess in my code... here's a more readable code (without the
descriptions)

Private Sub soktext_Change()
    Dim lb As ListBox
    Dim i As Integer
    Dim textlen As Integer
    Dim txt As String

    txt = Me.soktext.Text
    textlen = Len(txt)
    Set lb = Me.Oppslist
    For i = 1 To lb.ListCount
        If Left(lb.ItemData(i), textlen) = txt Then
            lb.Selected(i) = True
            Exit For
        End If
    Next
End Sub



Relevant Pages

  • Re: Listing files in a listbox
    ... Put 'er in the listbox using .Additem ... > subfolders since it didn't sound like you would have that situation. ... > Dim FSO As Scripting.FileSystemObject ... > Private Sub ListBox1_AfterUpdate ...
    (microsoft.public.excel.programming)
  • RE: form w/ listbox, select record to show the rest on the form...
    ... Private Sub ComboSearch_AfterUpdate ... Dim rs As Object ... I changed it to a listbox. ...
    (microsoft.public.access.forms)
  • Re: Selection based on partial input
    ... > I need to enable the user to input the beginning of a name in the> textbox, ... > and, as each new typed character comes in, I want the listbox to> display ... Dim TextArray() As String ... Private Sub UserForm_Initialize ...
    (microsoft.public.excel.programming)
  • RE: Passing a fields data into various forms
    ... Private Sub btnSearch_Click ... Dim stLinkCriteria As String ... 'Passes the value from the search form to the original form ... > the form also has a search button, and a listbox. ...
    (microsoft.public.access.formscoding)
  • Re: Drag from ListBox to DirListBox
    ... I changed the Private Sub List3 to Private Sub ... > The data in a listbox, even if a list of file names, are text as far as ... > Dim tmp As String ... > Dim buffAs String ...
    (microsoft.public.vb.general.discussion)