Results 1 to 3 of 3

Thread: Help for Filter Combobox (DropDown) in TDBGrid

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2010
    Posts
    250

    Wink Help for Filter Combobox (DropDown) in TDBGrid

    I need help guys.

    I designed Grid to hold data using ComponentOne TdbGrid and in first column I put TdbDropDown to show selection for data.
    What I really want, how can I filter combobox data each time user input each letter, the data must filter based on LIKE query, so only what query filtered will be shown on combobox dropdown
    \I tried filter but failed, and i think I almost there, only maybe what Event I should put my code

    Code:
    On Error GoTo BCEErr
        Dim TempTxt As String
        Select Case ColIndex
            Case 0
            Select Case bJenis
            Case 0            
                    TempTxt = "SELECT fID,fNameGoods FROM tbGoods  ORDER BY fNameGoods"
                    Set BarangRS = dB.Execute(TempTxt)
                    BarangRS.Filter = "fNameGoods LIKE '" & tgBeli.Columns(0).Text & "'"
                    Set TDD.DataSource = BarangRS           
            End Select
        End Select
        Exit Sub
    BCEErr:
        MsgBox err.Description, vbCritical
    I put inside BeforeColEdit event and ColEdit event, no result as I expected

    Please help

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Help for Filter Combobox (DropDown) in TDBGrid

    The LIKE clause should have at least one wild card. If no wild cards, then it is the same as comparing equality.
    Ex: BarangRS.Filter = "fNameGoods LIKE '" & tgBeli.Columns(0).Text & "%'"
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2010
    Posts
    250

    Re: Help for Filter Combobox (DropDown) in TDBGrid

    Thank you for your comment LaVolpe
    Is this the great LaVolpe (created button ) ?

    I tried to use wildcard, and the result ok, only if filter input first.
    But what happened later, what i need is... each user type letter on keyboard the dropdown combo will be refresh with new filter.
    I put inside BeforeColEdit event (only triggered once) and ColEdit (triggered one time only when user press letter)

    How can I refresh dropdown each time user press letter on keyboard

    Thank you

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width