1 Replies - 392 Views - Last Post: 09 April 2013 - 01:15 PM Rate Topic: -----

#1 pathllk  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 26-July 11

WANT TO SERCH TEXT IN DATAGRID VIEW THROUGH ALL COLUMNS

Posted 09 April 2013 - 01:05 PM

Hi All, I want to find item in datagrid view & I used the given below code for that:-

 Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
        Dim DV As New DataView(MYTABLE)
        DV.RowFilter = "DES LIKE '%" & TextBox3.Text & "%'"
        DataGridView1.DataSource = DV
    End Sub



But the above code filters the item through a single column. I want to search the datagridview through all the columns. If it possible friends, if yes please suggest me.

Is This A Good Question/Topic? 0
  • +

Replies To: WANT TO SERCH TEXT IN DATAGRID VIEW THROUGH ALL COLUMNS

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8364
  • View blog
  • Posts: 31,069
  • Joined: 12-June 08

Re: WANT TO SERCH TEXT IN DATAGRID VIEW THROUGH ALL COLUMNS

Posted 09 April 2013 - 01:15 PM

It seems a bit outrageous that *EVERY* column in your data grid can be searched by the same input, but okay... I can roll with it.

How about just using a pair of for loops to go through each row and each cell? I am also guessing there's a LINQ query that could be made as well.

If you are set on the 'rowfilter' you can always just dynamically make that filter statement by going through all the column names and appending the textbox value.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1