Results 1 to 3 of 3

Thread: [Solved] Datagridview Filter only works when exact text is typed

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2014
    Posts
    21

    [Solved] Datagridview Filter only works when exact text is typed

    Ok so my import code is

    Code:
    Dim dt As New DataTable
    
            Using cn As New OleDb.OleDbConnection With {.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\ExcelWork.xlsx;Extended Properties=""Excel 12.0 Xml;HDR=YES"""}
                Using cmd As New OleDb.OleDbCommand With {.Connection = cn}
                    cmd.CommandText = "SELECT * FROM [Sheet1$]"
                    cn.Open()
                    dt.Load(cmd.ExecuteReader)
                End Using
            End Using
    
            bsData.DataSource = dt
            DataGridView1.DataSource = bsData
    I have the WithEvents thing at the top

    Code:
    Public Class Form1
        WithEvents bsData As New BindingSource
    My filtering statement is (It's in a textchanged Sub)

    Code:
    bsData.Filter = "PartNumber = '" & txtSearch.Text & "'"
    To filter the PartNumber Column for the text in txtSearch


    When I filter the filter only works if I type the EXACT text (which is a long part number) in the text box. Shouldn't it just reduce the results so I don't have to type the whole thing
    Last edited by 1635321; Jul 7th, 2014 at 10:16 AM.

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