search filter with textbox...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • djpaul
    New Member
    • Oct 2006
    • 137

    search filter with textbox...

    Hello,
    I trying to make an program for my cd collection.
    I wanted to insert all my cd's into a access database.
    Then, with the program, i want to search for a title or artist.
    So, my question is, how can i do that if i look for example" bon jovi - It's my live", i type in the textbox "bon jo" that he only display all the songs/artists with these letters at the right side.(i mean, on the left side the textbox and the right side the whole cd collection.).
    If you use winamp, you know what i mean (J to jump to...)

    Gr Paul
  • albertw
    Contributor
    • Oct 2006
    • 267

    #2
    hi

    suppose all your cd's are listed in a listbox
    this is the fastest way to find a name.

    use:

    Code:
    Const LB_FINDSTRING = &H18F
    Const LB_FINDSTRINGEXACT = &H1A2
    Din LstNdx as Integer
    
    Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As String) As Long
    in your delclaration.

    then use:

    Code:
    LstNdx = SendMessage(lstCDs.hWnd, LB_FINDSTRING, -1, txtCDName.Text)
    ' to look up the listindex of the cd to find
    txtCDName.Text=lstCDs.List(LstNdx)
    ' to get the whole text
    if you call the code above from txtCDName_Chang e, the text will change after every keystroke (annoying)
    better create a button to trigger the code.
    or call from

    Code:
    Private Sub txtCDName_KeyDown(KeyCode As Integer, Shift As Integer)
    if KeyCode=VBKeyReturn then
    txtCDName.Text=lstCDs.List(LstNdx)
    End If

    Comment

    • djpaul
      New Member
      • Oct 2006
      • 137

      #3
      Hmm, this must be vb, isn't it?
      I'm using/learning .Net.
      Maybe you know how to do that?

      Thanx
      Paul

      Comment

      • albertw
        Contributor
        • Oct 2006
        • 267

        #4
        Originally posted by djpaul
        Hmm, this must be vb, isn't it?
        I'm using/learning .Net.
        Maybe you know how to do that?

        Thanx
        Paul
        sry, no idea abt .net
        haven been using vb6 since 8 years now and love it .. :)

        Comment

        • djpaul
          New Member
          • Oct 2006
          • 137

          #5
          okay, keep on the good work !
          I will post it at .net forum.... sorry, didn't look to good!

          Paul

          Comment

          • rekedtechie
            New Member
            • Feb 2012
            • 51

            #6
            after 6 years ago..

            'use adodc
            'use datagrid
            'put this code in the Sub of txtboxName_cang e()

            Dim strArtist As String
            strArtist = Trim(txtboxName .text)
            adodc1.doSql "select * from my_song_tbl where fld_artist_name like '"& strArtist &"%'"

            'set the datagrid datasouce in adodc1
            'waw.. trending topic.. hahaha.. :))

            Comment

            Working...